mysql_ERROR 1045 (28000): Access denied for user ‘xxx’@’xxx’解决

#1 -> su - root    
#1 -> /etc/init.d/mysqld stop
#1 -> mysqld_safe --skip-grant-tables &
#2 -> mysql -uroot -p密码 -h127.0.0.1 
#2 -> mysql -uroot -p密码 -h127.0.0.1 --protocol=tcp
>use mysql;
>select host,user from mysql.user;
#>DROP USER 'train'@'%';
#>DROP USER 'train'@''
>CREATE USER 'train'@'localhost' IDENTIFIED BY '123456'; #注意添加新用户时需要填写如'train'@'localhost'而不是train就可以的
>flush privileges;
#1 -> jobs
#1 -> service mysqld stop
#1 -> kill %1
#1 -> service mysqld start
mysql -u用户名 -p密码




邮箱地址不会被公开。 必填项已用*标注

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see

Protected with IP Blacklist CloudIP Blacklist Cloud