参考来源:node
http://blog.csdn.net/liyf155/article/details/61419623mysql
1.下载:sql
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tarvim
2.安装:centos
[root@localhost Desktop]# rpm -qa|grep mysql # 查看是否已安装
mysql-libs-5.1.61-4.el6.x86_64
[root@localhost Desktop]# rpm -e --nodeps mysql-libs-5.1.61-4.el6.x86_64 #卸载安全
解压:tar -xf mysql-5.7.12-1.el6.x86_64.rpm-bundle.tarbash
顺序依次安装:ide
rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpmui
rpm -ivh mysql-community-libs-5.7.12-1.el6.x86_64.rpm编码
rpm -ivh mysql-community-devel-5.7.12-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.12-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.12-1.el6.x86_64.rpm
安装最后一个包的时候报错:
error: Failed dependencies:
libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.12-1.el6.x86_64
缺乏依赖包:
numactl
下载:wget http://mirror.centos.org/centos/6/os/x86_64/Packages/numactl-2.0.9-2.el6.x86_64.rpm
安装:rpm -ivh numactl-2.0.9-2.el6.x86_64.rpm
安装成功
继续上次安装完成
启动mysql服务:service mysqld start
[root@localhost mysql5.7]# service mysqld start Initializing MySQL database: [ OK ] Installing validate password plugin: [ OK ] Starting mysqld: [ OK ] [root@localhost mysql5.7]#
登录:mysql -u root -p,初次登陆密码为空,直接回车
[root@localhost mysql5.7]# mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
为何会出现这个错误,缘由是由于MySQL5.7中的mysql.user 表中没有Password字段,因此要以安全方式登陆,而后修改密码。
解决方法以下:
修改MySQL配置文件:vim /etc/my.cnf,在文件末尾加上:skip-grant-tables,保存后重启MySQL服务:service mysqld restart,而后从新登陆。
[root@localhost mysql5.7]# service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ] [root@localhost mysql5.7]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.12 MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
修改密码:
use mysql;
update user set password_expired='N' where user='root’;
update user set authentication_string=password('123456') where user=’root‘;
flush privileges;
修改MySQL配置文件:vim /etc/my.cnf,去掉文件末尾:skip-grant-tables
重启MySQL服务:service mysqld restart
其余:
set global validate_password_policy=0;
set global validate_password_mixed_case_count=0;
set global validate_password_number_count=3;
set global validate_password_special_char_count=0;
set global validate_password_length=3;
SHOW VARIABLES LIKE 'validate_password%';