遇到错误ERROR 1044 (42000): Access denied for user ''@'localhost'to database 'mysql',的解决办法

新装的mysql,访问mysql数据库是遇到问题:ERROR 1044 (42000): Access denied for user ‘‘@‘localhost‘to database ‘mysql‘,

[[email protected] mysql-5.1.61]# 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.1.61 Source distribution

Copyright (c) 2000, 2011, 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> use mysql

ERROR 1044 (42000): Access denied for user ‘‘@‘localhost‘ to database ‘mysql‘

mysql>

最后发现解决方案是:

打开my.ini,在

[mysqld]

skip-external-locking

skip-name-resolve

#skip-grant-tables

其中skip-grant-tables跳过权限验证是被注释掉的,去掉注释,重新启动mysql:

[[email protected] libexec]# /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/data0/mysqldata --user=mysql --log-error=/data0/mysqldata/mysql-error.log --open-files-limit=20000 --pid-file=/data0/mysqldata/dzwww.com-B15-5-3-36.pid
--socket=/tmp/mysql.sock --port=3306

[[email protected] mysql-5.1.61]# 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.1.61-log Source distribution

Copyright (c) 2000, 2011, 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> use mysql

Database changed

mysql>grant all privileges on *.* to [email protected] identified by ‘mysql‘

然后重新登录 ok,成功!

遇到错误ERROR 1044 (42000): Access denied for user ''@'localhost'to database 'mysql',的解决办法

时间: 2024-12-20 19:38:24

遇到错误ERROR 1044 (42000): Access denied for user ''@'localhost'to database 'mysql',的解决办法的相关文章

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

在centos下安装好的mysql,用root帐号连上mysql,查看数据库结果只有information_schema库,我原来的库和mysql库都不见了,然后执行use mysql提示错误,如下: mysql> use mysql; ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql' 提示:ERROR 1044 (42000): Access denied for user ''@'loc

解决 ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

原文链接:https://blog.csdn.net/sea_snow/article/details/82498791 感谢原作者大大  提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'.是因为mysql数据库的user表里,存在用户名为空的账户即匿名账户,实际上是匿名登录的,通过错误提示里的''@'localhost'可以看出来,于是解决办法见方法二. 方法一:(适用于密码不正确的

Mysql,ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql' 刚在服务器上装上mysql,发现以root加密码的方式总是登录不了,而直接输入mysql则直接就可以登录了.或者以mysql –u root方式可以登录,但是实习上登录上去也是一个空用户(''@'localhost'),不是root用户,看不了其他数据库. 干货,删除空用户方法 1.关闭mysql service mysqld stop 或者

mysql忘记root密码或报错:ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘xx‘

有的时候忘记了root密码或其他用户的密码,登录的时候报错:ERROR 1044 (42000): Access denied for user ”@’localhost’ to database 'xx'.下面是具体的解决方法: 1.关闭mysql #service mysqld stop 2.屏蔽权限 # mysqld_safe --skip-grant-table 3.新开起一个终端输入 # mysql -u root mysql # mysql> UPDATE user SET Pass

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'

1.问题 在刚刚安装MySQL之后,进入到mysql环境下,创建数据库,出现下面的提示信息: ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db' 2.原因 未用账号登录,而是直接用mysql进入,只拥有查看的权限: 3.解决方案 3.1 使用exit;退出mysql环境: mysql> exit; 3.2 重新使用账号登录 mysql -u root -p ERROR 1044 (42000): A

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'ambari'

配置Ambari远程maridb 报错: ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'ambari' 在环境搭建的过程中,在 #用Ambari用户(上面设置的用户)登录mysql ,(没有密码) mysql -u ambari -p use ambari: source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql 遇到了:

ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'mysql'(转)

解决ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql' 原创 2014年05月11日 11:42:25 # /etc/init.d/mysql stop # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # mysql -u root mysql mysql> UPDATE user SET Passwor

Access denied for user ''@'localhost' to database 'mysql'。网上找了一些方法,终于搞定了。

转载:http://blog.csdn.net/lilian129/article/details/9297881 这几天用空密码登录mysql后,然后修改mysql默认密码,使用mysql表出现过这个问题,提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'.网上找了一些方法,终于搞定了. 我用的是xampp集成的mysql,之前空密码能登进去phpmyadmin,但怎么也进不去phpm

解决Access denied for user ''@'localhost' to database 'mysql'

在centos下安装好了mysql,用root帐号连上mysql,然后创建一个数据库,提示下图错误: 提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'.网上找了一个比较流行的方法(见方法一),搞定了.今天又用这个试了试,却搞不定,在网上找了半天,终于发现是因为mysql数据库的user表里,存在用户名为空的账户即匿名账户,导致登录的时候是虽然用的是root,但实际是匿名登录的,通过错误