Centos7下安装Mysql5.7出现 ‘root‘@‘localhost‘ (using password: NO)

编程入门 行业动态 更新时间:2024-10-12 22:26:44

Centos7下安装Mysql5.7出现 ‘<a href=https://www.elefans.com/category/jswz/34/1770209.html style=root‘@‘localhost‘ (using password: NO)"/>

Centos7下安装Mysql5.7出现 ‘root‘@‘localhost‘ (using password: NO)

1.注意是No,常规是(using password: YES)
2.首先关闭mysql服务
service mysqld stop
3.修改配置文件跳过密码验证

vim /etc/myf[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
skip-grant-tables

保存退出
就可以无密码登录Mysql

mysql -uroot

修改user表中的密码,5.7user表密码字段更改不是password

mysql> update user set password=password("*******") where user="*******";  #修改密码报错
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql> update mysql.user set authentication_string=password('*******') where user='*******';  #修改密码成功
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1mysql> flush privileges;  #立即生效
Query OK, 0 rows affected (0.00 sec)mysql> quit
Bye

退出mysql,改回原配置文件,重启MySQL

更多推荐

Centos7下安装Mysql5.7出现 ‘root‘@‘localhost‘ (using password: NO)

本文发布于:2024-02-10 22:27:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1677647.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:root   password   localhost

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!