

Step 4: Change the auth_plugin to mysql_native_password, and the password for the root account, in a single command: ALTER USER WITH mysql_native_password BY 'your_new_password'

Step 3: Enter the password for this account. Step 2: Open mysql using the sudo command: sudo mysql

Step 1: Open the command line on your system. If you get the “access denied” error, one way to solve it is by using sudo to log in to mysql and change the root password. Use the -p option, as mentioned above, and then you’ll be prompted to enter the password. Try one, and if it doesn’t work, try another one.Īlso a tip for logging in: don’t enter your password in the command line itself, because this will be stored in your command history. There are a few solutions to this, which I’ve detailed below. You might also see this if you log in to MySQL using an IDE such as MySQL Workbench. You’ll see this if you log into MySQL using the command line: mysql -u root -p You might also get the error with “using password no”: Access denied for user (using password: NO) You might get an error code in front of it: ERROR 1045 (28000): Access denied for user (using password: YES) When you try to connect to a MySQL database on your own computer (called “localhost”), you may get this error: Access denied for user (using password: YES)
