I face a problem with the access to MySQL. I need to create and import a database but my default user have no necessary privileges to do it.

I am using Ubuntu 16.04, additional details about OS and platform:

# uname -a
Linux improve1 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:36:54 UTC 2017 i686 i686 i686 GNU/Linux

This is my MySQL version:

# mysql --version
mysql  Ver 14.14 Distrib 5.7.17, for Linux (i686) using  EditLine wrapper

The only user created (I was allowed to create only it) during installation is named "phpmyadmin".

If I make attempt to use this user privileges using phpMyAdmin (at http://localhost/phpmyadmin) I see "No Privileges"

If try to do it after console login I have the following problem:

mysql> CREATE DATABASE bulterm;
ERROR 1044 (42000): Access denied for user 'phpmyadmin'@'localhost' to database 'bulterm'

When I check the privileges of this user I see the following:

mysql> SHOW GRANTS FOR 'phpmyadmin'@'localhost';
| Grants for phpmyadmin@localhost                                    |
| GRANT USAGE ON *.* TO 'phpmyadmin'@'localhost'                       |
| GRANT ALL PRIVILEGES ON `phpmyadmin`.* TO 'phpmyadmin'@'localhost'  |
2 rows in set (0,00 sec)

But when I try to execute any operation like creating database, creating new user etc., I am restricted.

I want to create a MySQL user "root" with full privileges to do everything.

How can I resolve my problem?

  • Lets confirm, is there any root user? Please check with mysql> SHOW GRANTS FOR 'root'@'localhost'. Jan 24, 2017 at 12:28
  • The result is even stranger than the problem itself: mysql> SHOW GRANTS FOR 'root'@'localhost'; ERROR 1044 (42000): Access denied for user 'phpmyadmin'@'localhost' to database 'mysql'
    – FrontIm1
    Jan 24, 2017 at 12:55

3 Answers 3


In three steps:

sudo systemctl stop mysql
sudo dpkg-reconfigure mysql-server-5.7
sudo systemctl start mysql

The middle steps will allow you to change the root password.

  • # dpkg-reconfigure mysql-server-5.7 RETURNS THE FOLLOWING dpkg-query: package 'mysql-server-5.7' is not installed and no information is available Use dpkg --info (= dpkg-deb --info) to examine archive files, and dpkg --contents (= dpkg-deb --contents) to list their contents. /usr/sbin/dpkg-reconfigure: mysql-server-5.7 is not installed
    – FrontIm1
    Jan 24, 2017 at 13:04
  • 1
    While typing sudo dpkg-reconfigure mysql-server, use Tab keys to foreseen what's the mysql-server installed. Jan 25, 2017 at 6:52
  • Sometimes you may have installed mariadb-server instead of mysql. Jan 25, 2017 at 6:55

Try to Login user root and password same you are using with your Mysql User

Phpmyadmin panel will open and follow the steps:

1) goto users 2) check if your user exists for mysql users

User Host Password Global privileges Grant Action

3) click on Edit Privileges for specific user

4) Check Mark all global Privileges and Go

5) Login with your current user It will access to create and allow permission


  • Unfortunately I am unable to login as root. I see the following: #1045 - Access denied for user 'root'@'localhost' (using password: YES) mysqli_real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) Thanks for efforts!
    – FrontIm1
    Jan 24, 2017 at 13:26
  • Then go to Ubuntu /etc/phpmyadmin/config.inc.php .... check config file and find out : $cfg['Servers'][$i]['AllowNoPassword'] = TRUE; Depending on distributions, there could be multiple occurrences of that particular line. Ubuntu for example has the following 2 lines; if (!empty($dbname)) { // other configuration options $cfg['Servers'][$i]['AllowNoPassword'] = TRUE; // it should be placed before the following line $i++; } // other configuration options $cfg['Servers'][$i]['AllowNoPassword'] = TRUE; Jan 24, 2017 at 15:01

You need to open phpmyadmin.conf from the dbconfig-common folder and change the database user name from "phpmyadmin" to "root":

sudo gedit /etc/dbconfig-common/phpmyadmin.conf 

# dbc_dbuser: database user
#       the name of the user who we will use to connect to the database.

# dbc_dbpass: database user password
#       the password to use with the above username when connecting
#       to a database, if one is required

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .