Installation steps
Before installing, we can detect whether the system comes with MySQL installed:
rpm -qa | grep mysql
If you have a system installed, you can choose to uninstall:
rpm -e mysql // 普通删除模式rpm -e --nodeps mysql
Installation
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm rpm -ivh mysql57-community-release-el7-9.noarch.rpm yum install mysql-server
Initialize MySQL:
mysqld --initialize
Start MySQL:
systemctl start mysqld
To view MySQL running status:
systemctl status mysqld
CentOS Start MySQL Error
$ systemctl status mysqld.service● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: activating (start-pre) since 一 2018-09-03 06:27:17 EDT; 631ms ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 26472 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)Control: 26489 (mysqld_pre_syst) Memory: 26.6M CGroup: /system.slice/mysqld.service └─control ├─26489 /bin/bash /usr/bin/mysqld_pre_systemd └─26506 /usr/bin/python -Es /usr/sbin/semanage fcontext -a -e /var/lib/mysql /var/lib/mysql-files
September 06:27:17 TEST241VM22 systemd[1]: Starting MySQL Server ...
Solutions
chown mysql:mysql -R /var/lib/mysql
Modify the initial password
You must reset your password using ALTER USER statement before executing this statement.
After the installation of MySQL, after landing, regardless of running any command, always prompt this
Step 1:set PASSWORD = PASSWORD (' Your new PASSWORD ');
Step 2:alter USER ' root ' @ ' localhost ' PASSWORD EXPIRE never;
Step 3:flush privileges;
Create user, authorize remote login
create user ‘test‘@‘10.1.3.200‘ identified by ‘123456‘;grant all privileges on *.* to ‘sl_test‘@‘10.100.0.0‘; flush privileges;
Import Database
source /data/model/tables.sql
CentOS installs MySQL process and resolves startup failure issues