0

I've searched a lot but nothing works for me.

I have a fresh installation of a LAMP server, installed via tasksel command. My system runs php 7.4 and MySql 8

For some reason root user (that in my case is called phpmyadmin, by default) has no privileges on the DBs.

I can log in, so I'm sure the password is correct, but I cannot create a Database.

$ mysql -u phpmyadmin -p

mysql > create database test;
Access denied for user 'phpmyadmin'@'localhost' to database 'test'

EDIT

As suggested, here's the output of

 mysql> SELECT name, Create_priv FROM mysql.user;

 SELECT command denied to user 'phpmyadmin'@'localhost' for table 'user'

NEW EDIT

I tried to access without the password, following the guide reported here: ...

No results for me :(

  • Stop the MySQL Server: sudo /etc/init.d/mysql stop (OK)
  • Start the mysqld configuration: sudo mysqld --skip-grant-tables

output:

[2] 2345

[1] Exit 1 sudo mysqld --skip-grant-tables

  • Run: sudo service mysql start

output

[2]+ Exit 1 sudo mysqld --skip-grant-tables

It seems to exit with errors... Am I wrong?

I also tried to login in that situation, but I receive this message "ERROR 1698 (28000) Access denied for user 'root'@'localhost'"

If I try my phpmyadmin user, the message is "ERROR 1045 (28000): Access denied for user 'phpmyadmin'@'localhost' (using password: NO)"

EDIT 06/19/2020 I followed the steps reported here How to reset or change the MySQL root password?

I had to use MD5() instead of PASSWORD() because it's now deprecated.

There's still something wrong. Now I can access the database with no privileges and set/change my password. Then I can flush all privileges.

Then I try...

mysql -u root -p I enter my new password... ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I can still log in with the user set in phpMyAdmin, but there are still no privileges for me.

I also reinstalled MySql server. I remember I had a similar problem last time I installed an old Linux Virtual Machine, but I solved that issue easily. Now I'm wondering what's wrong :(

Simone Conti
  • 349
  • 1
  • 17
  • 2
    Please [edit] your question to include the output of `SELECT name, Create_priv FROM mysql.user;`. – Progman Jun 18 '20 at 18:12
  • Information added... no good news. – Simone Conti Jun 18 '20 at 18:41
  • Does the "root" user still exists and can you use it to login? – Progman Jun 18 '20 at 18:44
  • I really don't know. I always use the 'phpmyadmin' users and I cannot see if there's a standard root user for mysql. As you can see from the result of the query you suggested, I cannot select from users to know if it works. I believe I'll try to remove and reinstall mysql – Simone Conti Jun 18 '20 at 19:08
  • You can run the MySQL server without permission checks, see https://stackoverflow.com/questions/16556497/how-to-reset-or-change-the-mysql-root-password. That way you can fix the permissions and then restart the MySQL server again. – Progman Jun 18 '20 at 19:10
  • @Progman. I edited my question... – Simone Conti Jun 18 '20 at 19:32
  • If `--skip-grant-tables` is not working as it should, set this flag in the config file, see the answer https://stackoverflow.com/questions/16556497/how-to-reset-or-change-the-mysql-root-password/31751883#31751883 – Progman Jun 18 '20 at 19:34
  • What did you do before this chaos started? Did you re-install? Update? – Eduards Jun 19 '20 at 06:58
  • @LV98 I had a clean and fresh installation (directly from osboxes.org). I simply run tasksel to install PHP and MySQL server. I just added phpmyadmin. Nothing else. Yesterday, after several tests, I reinstalled MySql Server. – Simone Conti Jun 19 '20 at 07:11
  • @SimoneConti How did you clean it? Did you restore your computer? – Eduards Jun 19 '20 at 09:01
  • @LV98 I just uninstall the server, did some autoremove and autoclean, and reinstall it. It's a basic virtual machine. – Simone Conti Jun 19 '20 at 09:55
  • Can you try this. https://stackoverflow.com/a/1709138/12485722 – Eduards Jun 19 '20 at 09:59
  • Allready tried all methods. I believe I will reinstall the Virtual Machine again... but I'm pretty sure that nothing will change. – Simone Conti Jun 19 '20 at 10:59

1 Answers1

0

SOLVED I reinstalled my virtual machine and installed manually both php and mysql server. To be sure to set privileges in the right way I followed this small guide... maybe helpful for someone. https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04

Bye!

Simone Conti
  • 349
  • 1
  • 17