链接:https://pan.baidu.com/s/1xvtk5OkK4c93bP8w9mIUMQ
提取码:iv2q
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# tar -zxvf mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# mv mysql-5.7.35-linux-glibc2.12-x86_64 mysql
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# cat /etc/group | grep mysql
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# cat /etc/passwd | grep mysql
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# groupadd mysql
groupadd: group 'mysql' already exists
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# useradd -r -g mysql mysql
useradd: user 'mysql' already exists
[root@iZwz9br4vz6tthgk5jupa6Z mysql]#
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# mkdir data
chown -R mysql.mysql /usr/local/mysql/mysql
vim /etc/my.cnf
添加下面内容:
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
basedir = /usr/local/mysql/mysql
datadir = /usr/local/mysql/mysql/data
port = 33061
socket = /tmp/mysql.sock
character-set-server=utf8
log-error = /usr/local/mysql/mysql/data/mysqld.log
pid-file = /usr/local/mysql/mysql/data/mysqld.pid
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# yum install libaio
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/mysql/ --datadir=/usr/local/mysql/mysql/data/
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# cat /usr/local/mysql/mysql/data/mysqld.log
2021-10-27T01:14:37.321305Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-10-27T01:14:37.321395Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2021-10-27T01:14:37.321399Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2021-10-27T01:14:38.375914Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-10-27T01:14:38.556683Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-10-27T01:14:38.627168Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 4173c545-36c3-11ec-8b39-00163e04480e.
2021-10-27T01:14:38.631909Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-10-27T01:14:39.065173Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2021-10-27T01:14:39.065187Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2021-10-27T01:14:39.065874Z 0 [Warning] CA certificate ca.pem is self signed.
2021-10-27T01:14:39.193949Z 1 [Note] A temporary password is generated for root@localhost: s2Jcufq&JDZG
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# service mysql start
登录mysql
[root@iZwz9br4vz6tthgk5jupa6Z mysql]# ./bin/mysql -u root -p
mysql> set password=password('root');
mysql> grant all privileges on *.* to root@'%' identified by 'root';
mysql> flush privileges;
mysql> service mysql restart