安装mysql:
1、下载rpm包:# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
2、安装rpm包,# rpm -ivh mysql57-community-release-el7-7.noarch.rpm
3、安装mysql,# yum install mysql-community-server
4、查看mysql版本:#mysql -V
配置mysql:
1、启动mysql:# systemctl start mysqld
2、进入mysql:# mysql -uroot -p
3、启动失败报错Access denied for user 'root'@'localhost' (using password: NO)
解决:1.关闭mysql # systemctl stop mysqld
1.编辑配置文件
# vim /etc/my.cnf
最后面添加 :(跳过权限表的限制,不用密码验证,直接登录)
skip-grant-tables
2.启动mysql服务 # systemctl start mysqld
3.进入mysql: # mysql
4.修改密码: (密码要够复杂,包含大小写数字符号,不然后面对报错)
update mysql.user set authentication_string=password('Qwe123.') where User='root' and Host='localhost';
5.刷新配置: >flush privileges;
6.去掉skip-grant-tables配置项
完成安装配置。