user972946
user972946

Reputation:

phpMyAdmin says no privilege to create database, despite logged in as root user

I need to login to mysql using root user and create a database. However, when I login to PhpMyAdmin as root user, it tells me that it has "no privileges", therefore cannot create a database.

I did not expect this to happen when I installed phpMyAdmin. Is there a way to fix this? Please help, thank you!

Version info:

OS: OpenSUSE 12.1

MySQL: mysql Ver 14.14 Distrib 5.5.25, for Linux (x86_64) using readline 6.2

PhpMyAdmin: 3.4.10.2

Upvotes: 33

Views: 213861

Answers (13)

Jay Lin
Jay Lin

Reputation: 902

A solution was already accepted but this is how I solved this issue on Ubuntu:

  1. Open debian.cnf in view mode only! This file should not be altered!:

    sudo cat /etc/mysql/debian.cnf

  2. Use the user and password credentials to login to phpmyadmin.

  3. Once inside, you will see tabs for "Database, SQL, Status, and User accounts, etc." across the top. Go to User accounts and either alter the privileges of the user you prefer to use or create a new user (via 'Add user account' just under the user table) with the permissions you want for the user.

  4. Log out then log back in with the new or updated user

Upvotes: 0

Shubham
Shubham

Reputation: 83

This is a most common problem after installing phpmyadmin. you need to go with following steps for setting a new user.

sudo nano /etc/mysql/debian.cnf

then you get a file window/terminal where mentioned a user and a password. you have to login with this user and after this you need to create a new user and grant the permissions from following commond.you can run these query in phpmyadmin sql section.

  1. CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
  2. GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO 'username'@'localhost' WITH GRANT OPTION;
  3. GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;

and you get new user with all permissions.

Upvotes: 0

Udee
Udee

Reputation: 581

Login using the system maintenance user and password created when you installed phpMyAdmin.
It can be found in the debian.cnf file at /etc/mysql then you will have total access.

sudo nano /etc/mysql/debian.cnf

Just look - don't change anything!

[mysql_upgrade]
host     = localhost
user     = debian-sys-maint       <----use this user
password = s0meRaND0mChar$s       <----use this password
socket   = /var/run/mysqld/mysqld.sock

Worked for me.

Upvotes: 58

Matutino Life
Matutino Life

Reputation: 131

sudo mysql

enter your (LINUX) account password

grant create on *.* to user@localhost;
FLUSH PRIVILEGES;

Upvotes: 13

I solved my issue like that. You need the change auth_type 'config' to 'http'. My older settings auth_type is 'config' then i changed to 'http' and problem solved.

When you changed that area and enter the phpMyAdmin, browser asks you a user and password. You just enter 'root' and dont fill the password area and press enter.

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

Upvotes: 1

Douglas Tondo
Douglas Tondo

Reputation: 81

login in the terminal as a root and execute this command:

mysql_secure_installation

Type n in order to not change root password and hit enter, then type y to remove anonymous users and hit enter. Type n if you want to disallow root login remotely and hit enter. Now type y to remove test tables and databases and hit enter, then type y again and hit enter.

and you are good to go :)

Upvotes: 1

Pedro Sousa
Pedro Sousa

Reputation: 445

This worked for me(in Chrome):

Login to phpmyadmin, and follow "Home" -> "Privileges" -> "Reload the Privileges". After this, clear your browser's cache and retry.

Regards, Pedro Sousa

Upvotes: 1

user5256497
user5256497

Reputation: 1

My problem was on my KSWEB app that I downloaded. I am having no privileges error, but when I opened my config.inc.php and changed

$cfg['Servers'][$i]['auth_type'] = 'cookie';

to

$cfg['Servers'][$i]['auth_type'] = 'config';

It worked and I now have privileges to create a database.

Upvotes: 0

Moaz B
Moaz B

Reputation: 21

Use these:

  • username : root
  • password : (nothing)

Then you will get the page you want (more options than the admin page) with privileges.

Upvotes: 2

Adnan
Adnan

Reputation: 1409

This worked for me

open config.inc.php file in phpmyadmin root, set auth type from cookie to config

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ''; // leave blank if no password

Upvotes: 7

user972946
user972946

Reputation:

It appears to be a transient issue and fixed itself afterwards. Thanks for everyone's attention.

Upvotes: -4

Avinash
Avinash

Reputation: 2005

If you are using Chrome. try some other browser. there where previous posts on this issue saying that phpmyadmin didnot provide privileges for root on chrome.

or try this

name: root

password: password

Upvotes: 26

HJW
HJW

Reputation: 23443

Look at the user and host column of your permission. Where you are coming from localhost or some other IPs do make a difference.

Upvotes: 2

Related Questions