您的位置:首页 > 运维架构 > Linux

linux(ubuntu)Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'解决方法

2014-08-07 19:01 495 查看
今天在自己的机子上部署vj的时候上不去mysql数据库,通过以下两行命令轻松解决:

问题:

ttop@ttop-Lenovo:~$ mysql -u root -prootpass

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

解决:

root@ttop-Lenovo:/home/ttop# /etc/init.d/mysql stop

Rather than invoking init scripts through /etc/init.d, use the service(8)

utility, e.g. service mysql stop

Since the script you are attempting to invoke has been converted to an

Upstart job, you may also use the stop(8) utility, e.g. stop mysql

mysql stop/waiting

root@ttop-Lenovo:/home/ttop# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

[1] 5598

root@ttop-Lenovo:/home/ttop# 140807 18:54:42 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect.

140807 18:54:42 mysqld_safe Logging to '/var/log/mysql/error.log'.

140807 18:54:42 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

root@ttop-Lenovo:/home/ttop#

root@ttop-Lenovo:/home/ttop# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.38-0ubuntu0.12.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐