mysql ERROR 1044 (42000): Access denied for user ‘

What are the eight life cycle hook functions of Vue>>>

1. Problem Description:

When creating a database under MySQL console, the following information appears:

mysql> CREATE DATABASE python;
ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘python’

2. Solution: 2

Execute the following command to enter the console:

mysql –user=root -p

Enter the password of the root user to enter the MySQL console

To create a database:

create database python;

Show all databases:

show databases;

As follows:

www.linuxidc.com @ www.linuxidc.com :~$ mysql –user=root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2014,Oracleand/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> create database python;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_ schema |
| mysql |
| performance_ schema |
| python |
| test |
+——————–+
5 rows in set (0.02 sec)

mysql>

3. OK, the above method is not the best, but it is simple and feasible, enjoy it

4. Method 4

In recent days, after logging in to MySQL with an empty password, and then modifying the default password of MySQL, this problem occurred when using the MySQL table. The prompt is: error 1044 (42000): access denied for user ‘@’localhost’ to database ‘MySQL’. I found some methods on the Internet and finally got it done

I used MySQL integrated with xampp. Previously, an empty password could log in to phpMyAdmin, but it could not get into the system table of phpMyAdmin.

later, it was found that there was an account with an empty user name in the user table of MySQL database, which was called anonymous account. Although the login time was root, it was actually anonymous login, It can be seen from the “@” localhost “in the error prompt. I solved the problem with method 1,

method 1:
in my.ini [mysqld] field, add:

skip-grant-tables

Restart the MySQL service. At this time, MySQL can log in to the database without password
and then enter mysql

mysql> use mysql;
mysql> Update user set password = password (‘New password ‘) where user =’root’
mysql> flush privileges;

After running, remove skip grant tables in my.ini and restart mysqld< method 2 of modifying MySQL password:
do not use the method of modifying my.ini to restart the service, run MySQL in non service mode with skip grant tables to modify the MySQL password
stop the MySQL service
open the command line window and start it with mysqld-nt.exe in the bin directory, That is, execute in the command line window: mysqld NT — skip grant tables
and then open another command line window to log in to MySQL. At this time, you can enter without entering the MySQL password
after modifying the password according to the above method, close the window where the command line runs mysql, and then close mysql. If you find that MySQL is still running, you can close the corresponding process
start MySQL service

Processing method under linux:

mysql> use mysql
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'mysql'
mysql> exit
Bye
[[email protected] ~]# service mysqld stop 
Stopping mysqld:                      [ OK ]
[[email protected] ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 

[[email protected] ~]# mysql -u root -p -hlocalhost
Enter password: 

mysql> use mysql

mysql> SELECT host,user,password,Grant_priv,Super_priv FROM mysql.user;

mysql> UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';

mysql> FLUSH PRIVILEGES;

mysql> GRANT ALL ON *.* TO 'root'@'localhost';

mysql> GRANT ALL ON *.* TO 'root'@'cn.cn.cn.cn';

mysql> GRANT ALL ON *.* TO 'root'@'245.245.245.245';

mysql> GRANT ALL ON *.* TO 'root'@'127.0.0.1';

mysql> FLUSH PRIVILEGES;


mysql> quit
Bye
[[email protected] ~]# service mysqld start 

restart Linux/OS

Similar Posts: