返回顶部

MySQL免密登录操作

vi /etc/my.cnf

添加到配置文件里面放在[mysqld]下面
[mysqld]
skip-grant-tables
重启服务
systemctl restart mysql

登录:mysql
mysql> update mysql.user set password=password('root') where user='root' and host='localhost';
再次回到 /etc/my.cnf 把刚才添加的内容 删除了
systemctl restart mysql
mysql -uroot -proot

MariaDB [(none)]> ALTER USER "root"@"localhost" IDENTIFIED BY "chinaskill123";
posted @ 2023-05-18 10:47  IT-sec  阅读(149)  评论(0)    收藏  举报