Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't connect to mysql because there are no users

I mistakenly removed all users for mysql ... So I can't connect to mysql.
Does anyone has an idea ?
I tried reinstalling it but it didn't work ...

PS : I am on Archlinux.
Thanks in advance !

like image 345
Vinzgore Avatar asked Jan 07 '11 18:01

Vinzgore


People also ask

Why can I not connect to MySQL?

normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.

How do I get users in MySQL?

Use the following query to show MySQL users created in the database server: SELECT user FROM mysql. user; As a result, you will see the list of all the users that have been created in MySQL.

How do I add a user to a MySQL database?

MySQL CREATE USER ExampleStep 1: Open the MySQL server by using the mysql client tool. Step 2: Enter the password for the account and press Enter. Step 3: Execute the following command to show all users in the current MySQL server. Step 4: Create a new user with the following command.


1 Answers

This should help:

http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix

In your case, you'd change the init file to GRANT privileges to a new user.

like image 192
Riedsio Avatar answered Sep 26 '22 00:09

Riedsio