版权声明:作者-傲娇天子 博文主页地址:https://blog.csdn.net/qq_41116956 欢迎转载,转载请在文章页面明显位置给出原文链接,谢谢 https://blog.csdn.net/qq_41116956/article/details/82998099
安装:
1:下载rpm
[root@localhost local]# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
[root@localhost local]# ls mysql*
mysql57-community-release-el7-7.noarch.rpm
2:安装
[root@localhost local]# rpm -ivh mysql57-community-release-el7-7.noarch.rpm
[root@localhost local]# yum install mysql-community-server
查询安装版本
[root@localhost local]# mysql -V
mysql Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using EditLine wrapper
使用:
1:关闭mysql服务
[root@localhost local]# systemctl stop mysqld.service
当然:service mysqld stop也是能执行的
2:修改mysql配置为免密码登录
[root@localhost local]# vim /etc/my.cnf
增加下面一行
3:启动mysql
[root@localhost local]# systemctl start mysqld.service
4:登录
mysql -uroot -p #出现输入密码提示直接回车。
mysql> set password for root@localhost = password('123456');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> set password for root@localhost = password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql>flush privileges; #更新权限
mysql>quit; #退出
5:关闭mysql服务,将第二步中加上注释或者删除,启动mysql服务