[root@SHB-L0120796 bin]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
命令行登陆mysql数据库,如果有如上报错,可以my.cnf文件中插入skip-grant-tables;用于跳过权限验证
解决办法1:
1. 修改my.cnf文件
进入mysql的安装目录(根据个人mysql实际安装目录为准)
/usr/local/mysql
修改my.cnf,在[mysqld]后面插入skip-grant-tables
[mysqld]
socket=/usr/local/mysql/mysql.sock
# set mysql server port
port = 3306
# set mysql install base dir
basedir=/usr/local/mysql
# set the data store dir
datadir=/usr/local/mysql/data
# set the number of allow max connnection
max_connections=200
# set server charactre default encoding
character-set-server=utf8
# the storage engine
default-storage-engine=INNODB
lower_case_table_names=1
max_allowed_packet=16M
explicit_defa