0

I am trying to create a new user but whenever i launch the mysql shell and enter it as the root user using the command

mysql -u root -p

I get an error saying

ERROR 1524 (HY000): Plugin 'root' is not loaded
MrTux
  • 32,350
  • 30
  • 109
  • 146
  • 1
    It looks like you have overwritten the `plugin` column of the `user`-table with an invalid value ("root") (maybe by trying to manually update this table?). If you can login as a different user with full permissions, you can simply update this again, otherwise, the way to correct this is basically the same as resetting a lost password, see e.g [here](https://stackoverflow.com/a/37879449). You don't need to reset the password, just the `set plugin='mysql_native_password'` part (or `set plugin='auth_socket'`, depending on how you want to login/your server version). – Solarflare Oct 26 '19 at 07:23
  • @Solarflare the problem is when i connect with a second user (named by defaut "phpmyadmin"), which have **ALL PRIVILEGES** , and i try to `use mysql` it says that i dont have enough privileges. same thing happened when i've tried to create a user which is weird – Khaoula Arfaoui Oct 26 '19 at 17:24
  • The good thing is, your system still works, otherwise your couldn't login as phpmyadmin. You somehow messed up your login(s), and while it might be interesting what else is not working, the solution is (very likely) always the same: reset your root login as in the linked answer. (It disables permission checks, so you can just change anything you want, so specifically the root user). Step 2 is to figure out how to correctly do what you tried to do (when you messed up). For that, you add a new question including your goal, the code you entered (e.g. alter/create/update) and the problem you face. – Solarflare Oct 27 '19 at 11:53
  • problem solved :D thank you @Solarflare – Khaoula Arfaoui Oct 27 '19 at 21:37

1 Answers1

0

I solved my problem by adding a new user. step 1 to 3 might not be useful for all.

  1. $ sudo mkdir -p /var/run/mysqld;
  2. $ sudo chown mysql /var/run/mysqld;
  3. $ sudo mysqld_safe --skip-grant-tables &
  4. $ mysql -uroot # "-hlocalhost" is default
  5. try one of these (a) $ sudo mysql -u root -p;
    or
    (b) $ sudo mysql -u root;
  6. use mysql;
  7. CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';

if USER is already present delete it using -

DROP USER 'test'@'localhost';

this will create a new user . or you can modify the password for the same user. Option 4 and 5 will help to get you to mysql terminal, once you got there you can solve your issue.

kunal
  • 1