安装mysql5.7

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz

tar -zxf /app/mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz -C /usr/local

cd /usr/local

mv mysql-5.7.29-linux-glibc2.12-x86_64/ mysql

groupadd mysql && useradd -r -g mysql -s /sbin/nologin mysql

mkdir ./mysql/data

chown -R mysql:mysql ./mysql

cd mysql/bin/

./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

2021-08-03T17:45:32.410008Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-08-03T17:45:32.577914Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-08-03T17:45:32.607983Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-08-03T17:45:32.665963Z 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: 99b563cd-f482-11eb-a447-000c29ae3fa1.
2021-08-03T17:45:32.666838Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-08-03T17:45:33.123053Z 0 [Warning] CA certificate ca.pem is self signed.
2021-08-03T17:45:33.470176Z 1 [Note] A temporary password is generated for root@localhost: oXsKgc6rtt=n

A temporary password is generated for root@localhost: oXsKgc6rtt=n

./mysqld_safe #启动mysql

初始化mysql

./mysql_secure_installation

mysql_secure_installation: [ERROR] unknown variable 'default-character-set=utf8'
Securing the MySQL server deployment.
Enter password for user root: #输入密码

The existing password for the user account root has expired. Please set a new password.
New password:
Re-enter new password: #设置新密码

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: n #密码检查

Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
New password:
Re-enter new password: #确认修改密码(在输入一边新密码)

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y #删除匿名用户
Success.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n #是否允许root远程登陆

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y #删除测试数据库

  • Dropping test database...

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y #刷新,即刻生效
Success.

update mysql.user set authentication_string=password('biosan#17') where user='root' ;
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'biosan#17' WITH GRANT OPTION;
flush privileges;
update mysql.user set authentication_string=password('123456') where user='root'

-> ;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user user() identified by "123456";
Query OK, 0 rows affected (0.00 sec)

上一篇:C++程序设计课程师生互动(2012年春第9周)


下一篇:《Python分布式计算》 第7章 测试和调试分布式应用 (Distributed Computing with Python)