Access denied for user ''@'localhost' to database 'new' on mac

broken image
broken image

Method 2: (applicable to the presence of empty password) Mysql> FLUSH PRIVILEGES // Remember this sentence in the update command, otherwise, if you close the previous terminal, the original error will appear again MySQL > UPDATE user SET Password=PASSWORD(‘newpassword’) where USER=’root’ Mysqld_ safe –user=mysql –skip-grant-tables –skip-networking & // Using Linux Mysqld_ Safe - skip grant table// in Linux Method 1: (applicable to those with incorrect password)īy shielding the login password of MySQL, first enter into mysql, and then update the password through the update command Therefore, the solution is shown in method 2 It can be seen from the ‘localhost” in the error prompt.

broken image

The reason is that in the user table of MySQL database, there is an account whose user name is empty, that is, an anonymous account. Prompt: error 1044 (42000): access denied for user to database ‘MySQL’. After MySQL is installed, MySQL directly enters the databaseĪfter setting the remote connection, the following error will be prompted: