Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to the installation steps of mysql on centos7 system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the installation steps of mysql on the centos7 system, the contents of the article are carefully selected and edited by the author, with a certain pertinence, the reference significance for everyone is still relatively great, the following with the author to understand the installation steps of mysql on the centos7 system.

Mysql8

1. First download the rpm file from mysql's official website:

Shell > wget http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

If you are not satisfied with this version, you can log in to https://dev.mysql.com/downloads/repo/yum/ and choose your favorite version to download.

two。 After downloading the rpm package, use the yum that comes with centos to install:

Shell > yum install-y mysql80-community-release-el7-3.noarch.rpm

3. Then start the formal installation of the mysql CVM:

Shell > yum install-y mysql-community-server

4. After the installation is complete, start the mysql service (the service command is used for versions below centOS7, and the systemctl command is required for centOS7 to start):

Shell > systemctl start mysqld.service

5. Check to see if service started successfully:

Shell > systemctl status mysqld.service

After normal startup, the display is as follows:

6. Set Boot self-boot:

Shell > systemctl enable mysqldshell > systemctl daemon-reload

7. Get the temporary password that mysql sets by default for the root user:

Shell > grep "password" / var/log/mysqld.log

The password is as follows:

8. Enter mysql and change your password:

The password mysql > alter user 'root'@'localhost' identified by' Centos_root31' in the red box above shell > mysql-uroot-p

9. Empower remotely logged-in users:

Mysql > grant all privileges on *. * to 'xxx'@'%' identified by' xxx' with grant option;mysql > flush privileges

Mysql5.7

We have taken a different approach to installing myslq5.7, and the specific steps are as follows:

1. Download mysql's rpm package from https://dev.mysql.com/downloads/mysql/5.7.html#downloads, mainly downloading the following

Mysql-community-common-5.7.27-1.el7.x86_64.rpm

Mysql-community-libs-5.7.27-1.el7.x86_64.rpm

Mysql-community-libs-compat-5.7.27-1.el7.x86_64.rpm

Mysql-community-devel-5.7.27-1.el7.x86_64.rpm

Mysql-community-client-5.7.27-1.el7.x86_64.rpm

Mysql-community-server-5.7.27-1.el7.x86_64.rpm

two。 Query whether there is an old mysql on the system

Shell > rpm-qa | grep-I mysql

If so, delete the relevant rpm in turn using the following command (replace the xxx with the name found)

Shell > rpm-e xxx-- nodeps

3. Create a mysql user

Shell > groupadd mysqlshell > useradd-r-g mysql mysql

4. Copy the rpm package downloaded above to the / usr/local directory, then go to that directory and execute it in the order of rpm above

Shell > rpm-ivh xxx.rpm

There may be some problems when installing mysql-community-common-5.7.27-1.el7.x86_64.rpm, such as conflicts caused by the mariadb that comes with the system. You just need to delete it and reinstall it, and you may also encounter missing packages during installation, such as perl, where you can check the version through yum search perl, and then use yum install to install (install what is missing here)

Shell > rpm-e mariadb-libs-1:5.5.56-2.el7.x86_64-- nodepsshell > yum install perl.x86_64

5. Edit the configuration file vi / etc/my.cnf

[client] default-character-set=utf8socket=/tmp/ mysql.sock [mysqld] character_set_server=utf8max_connections = 500datadir = / var/lib/mysqlmax_allowed_packet = 16Mlower_case_table_names=1log-error=/var/log/mysqld.logsocket=/tmp/mysql.sockdefault-storage-engine=InnoDB#replication settingsserver-id = 103log_bin = mysql-binsync_binlog = 0binlog_format = rowexpire_logs_days=60#innodb settingsinnodb_flush_log_at_trx_commit = 2innodb_buffer_pool_size=128Minnodb_log_buffer_size=16Minnodb_log_file_size=256Msql_mode=NO_ENGINE_SUBSTITUTION STRICT_TRANS_TABLES

6. Start mysql

Shell > systemctl start mysqld.service

An error was reported during execution. Check the alarm log tail-100 / var/log/mysqld.log and find that the error is [ERROR] Can't start server: Bind on unix socket: Permission denied. The error here is caused by insufficient permissions, mainly because the directory / tmp/mysql.sock of socket in the configuration file is modified to execute.

Shell > chmod 777 / tmpshell > chown-R mysql.mysql / var/lib/mysql

Re-execute the startup command. If it still fails, it is normal to restart the machine using reboot and then start mysql. For subsequent operations, please refer to mysql8 above.

After reading the above introduction of the installation steps of mysql on centos7 system, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report