ubuntu14.04 安装mysql 失败经历(Access denied for user 'root'@'localhost' (using password: YES))

# mysql -uroot -p 

输入密码:

-----》Access denied for user 'root'@'localhost' (using password: YES)

# cat /etc/mysql/debian.cnf

[client]
host     = localhost
user     = debian-sys-maint
password = hxhbsi8z7QApavYe
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = hxhbsi8z7QApavYe
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr
 

# mysql -u debian-sys-maint -p

输入密码:hxhbsi8z7QApavYe

Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)

# mysql

只有一个数据库

-----》information_schema

# SET PASSWORD FOR 'debian-sys-maint'@'localhost' = PASSWORD('hxhbsi8z7QApavYe');

# mysql -u debian-sys-maint -p

输入密码:hxhbsi8z7QApavYe

按照网上说的做了   啊  还是不行

最后找到 my.cnf

[mysqld]
#
# * Basic Settings
#
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket        = /var/run/mysqld/mysqld.sock
skip-grant-tables
port        = 3306
basedir        = /usr
datadir        = /var/lib/mysql
tmpdir        = /tmp
lc-messages-dir    = /usr/share/mysql
skip-external-locking
 

发现三个数据库

# use mysql;

# update user set password=PASSWORD("rootadmin") where user='root';

注释掉

[mysqld]
#
# * Basic Settings
#
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket        = /var/run/mysqld/mysqld.sock
#skip-grant-tables
port        = 3306
basedir        = /usr
datadir        = /var/lib/mysql
tmpdir        = /tmp
lc-messages-dir    = /usr/share/mysql
skip-external-locking

重启MySQL服务

ok

猜你喜欢

转载自blog.csdn.net/qq_41566772/article/details/84324251
今日推荐