I cannot access my Mysql Mariadb database

Asked

Viewed 1,811 times

0

I’m on Linux Deepin 15.19 and installed for Web Development, however when I can’t create new databases by Mysql Worckbench say:

Your Connection Attempt failed for user 'root' from your host to server at localhost:3306: Access denied for user 'root'@'localhost'

Please: 1 Check that mysql is running on server localhost 2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed) 3 Check the root has Rights to connect to localhost from your address (mysql Rights define what clients can connect to the server and from which machines) 4 Make sure you are Both providing a password if needed and using the correct password for localhost Connecting from the host address you’re Connecting from

I already tried to uninstall, I did everything. I tried to change the password by command

sudo mysql -u root 

and shortly after

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1234';

and even that doesn’t solve, what I have is a mistake.

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that Corresponds to your Mariadb server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1234'' at line 1

I really need your help because my development depends on it.

  • Matthew, the server is on the same machine that Workbench is on?

  • Try to enter the mysql root password equal to the root password of your machine.

  • Ué, Mysql and Mariadb are not different Sgbds? After all you are running Mysql or Mariadb?

2 answers

2


Well, from the messages seems to be a problem with the user and password, I saw that this distro is based on debian so I think it’s the same:

1 - Stop mysql process:

sudo /etc/init.d/mysql stop

2 - Restarts mysql process by not checking table permissions:

sudo /usr/sbin/mysqld --skip-grant-tables &

3 - Access the mysql client

 mysql -u root

4 - Execute the command below to exchange any password:

FLUSH PRIVILEGES;

5 - Then change root password

SET PASSWORD FOR root@'localhost' = PASSWORD('senha');

6 - Updates privileges:

FLUSH PRIVILEGES;

Restarts mysql in default mode:

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start

Controls removed and adapted from https://help.ubuntu.com/community/MysqlPasswordReset

  • Thank you, but did not resolve an error in command 5 >SET PASSWORD FOR root@'localhost' = PASSWORD('4321'); ERROR 1131 (42000): You are using Mariadb as an Anonymous user and Anonymous users are not allowed to Modify user Settings

0

Try to open your terminal and use the command

mysql -u root -p

this command will prompt your mysql password after typing must access mysql from the terminal. If you normally access the error is in some configuration of your Workbench. If you don’t normally access the error is in installing your mysql try uninstall and install again and perform the same test once more and make sure to enter the password correctly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.