[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables 加入此句,登录无需密码
#Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
2、systemctl restart mysqld 重启Mysql
[root@cuichengjie ~]# systemctl restart mysqld
3.mysql 登录 无需密码
[root@cuichengjie ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be tradem
1.vim /etc/my.cnf 进行编辑,加入skip-grant-tables[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockskip-grant-tables 加入此句,登录无需密码#Disabling symbolic-links is recommended to prevent assorte...