CentOS-64位安装mysql5.7
1.前言
因为直接使用yum install默认安装的版本是5.1,查阅官网后使用Yum Repository安装mysql5.7,这里下载的版本是mysql57-community-release-el6-11.noarch.rpm。
2.安装
1)添加yum repository
[root@localhost opt]# sudo yum localinstall mysql57-community-release-el6-11.noarch.rpm
[root@localhost opt]# yum repolist enabled | grep "mysql.*-community.*"
2)安装mysql
1 [root@localhost /]# sudo yum install mysql-community-server
3)启动mysql及查看服务
1 [root@localhost /]# service mysqld start 2 Initializing MySQL database: [ OK ] 3 Installing validate password plugin: [ OK ] 4 Starting mysqld: [ OK ] 5 [root@localhost /]# sudo service mysqld status 6 mysqld (pid 42363) is running...
4)修改密码
因mysql有默认密码,先生成临时密码,登录mysql后再修改密码。
1 [root@localhost /]# sudo grep 'temporary password' /var/log/mysqld.log 2 2017-06-27T15:19:54.431342Z 1 [Note] A temporary password is generated for root@localhost: InA1Mppj%R1K
登录mysql
1 [root@localhost /]# mysql -uroot -p 2 Enter password:
设置密码,mysql密码要求大、小写、数字、特殊字符各一个且长度不能低于八位。
1 Welcome to the MySQL monitor. Commands end with ; or \g. 2 Your MySQL connection id is 4 3 Server version: 5.7.18 4 5 Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. 6 7 Oracle is a registered trademark of Oracle Corporation and/or its 8 affiliates. Other names may be trademarks of their respective 9 owners. 10 11 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 12 13 mysql> alter user 'root'@'localhost' identified by 'yourpassword'; 14 Query OK, 0 rows affected (0.01 sec)
参考资料:
https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html
https://dev.mysql.com/doc/refman/5.7/en/validate-password-plugin.html