centos7.3安装mysql5.7 && 解决 Access denied for user 'root'@'localhost' (using password: NO)
开始查找自带的mariadb,rpm -qa | grep mariadb
找到安装包并卸载 rpm -e mariadb安装包
卸载完之后,我们就可以开始安装mysql5.7了,在这里可以找到我们需要的点击这里,
鼠标放在最下面那个No,thanks,just start my download上面右键复制链接,例如我得到了https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm这样一个地址。
接下来我们可以在终端 wget -c https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
来下载到本地。
接下来是安装mysql源rpm -ivh "下载下来的MySQL源包名"
,比如我的rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
安装mysql yum install mysql-server
如果用空密码登录的话,就像这样mysql -uroot -p
他会报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
,因为从mysql5.6开始就不支持空密码登录了,他会在自动生成一个随机的初始密码,这个密码你可以在/var/log/mysqld.log
这个路径下找到,如下就是我的初始密码fqMjNAKoE8*y。
你可以用初始密码登录,而后就可以修改密码在mysql表中。
use mysql;
set password=password("wzrmgHu88.*"); //这里注意密码要有大小写,特殊字符,以及数字,否则会报下面错误
//ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
到此结束。登录mysql没有问题了。mysql的服务启动service mysqld start
上一篇: 数据库表连接查询
下一篇: 关于内连接、左外连接和迫切左外连接
推荐阅读
-
win10下MySQL 8.0登录Access denied for user‘root’@‘localhost’ (using password: YES)问题的解决方法
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
MySQL密码正确却无法本地登录-1045 Access denied for user 'root'@'localhost' (using password:YES
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
java访问数据库被拒绝,不能连接数据库ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
-
ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using password: YES)实用解决方案
-
ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
-
Access denied for user 'root'@'localhost' (using password:YES) Mysql5.7
-
转载--MYSQL5.7:Access denied for user 'root'@'localhost' (using pa