简体   繁体   中英

How do I to create root user in phpmyadmin

I am not able to access my root account on phpmyadmin. I have my config.inc.php file set like this:

$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'admin24';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

When I try to login the root user on phpmyadmin, I get this error:

 mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)

And when I try to access the mysql terminal with the root user using this command:

mysql -u root -p

and after entering my password, I get this error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

What can I do to fix this?

1st step: remove password in config.inc.php file like

$cfg['Servers'][$i]['password'] = '';

2nd: go to localhost/phpmyadmin and log in without a password. 3rd: go to the user account tab and set a password (123) to 'root' user. 4th: this time fill your password into config.inc.php file

$cfg['Servers'][$i]['password'] = '123';

5th: now login with a password to phpmyadmin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM