John Davidson

php - How do I to create root user in phpmyadmin

0 comments
Message:


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?



My Answer:
If you are unable to access the root user in phpMyAdmin and through the MySQL terminal, it is possible that the password for the root user has been changed or is incorrect.

To reset the root password in phpMyAdmin, you can follow these steps:

1. Log in to phpMyAdmin with an existing user account that has administrative privileges.
2. Select the "User accounts" tab.
3. Find the root user in the list of user accounts and click on the "Edit privileges" link.
4. In the "Change password" section, enter a new password for the root user and make sure to select the appropriate authentication method (e.g. MySQL native password).
5. Click on the "Go" button to save the changes.

After resetting the root password in phpMyAdmin, try logging in again with the new password.

If you are still unable to access the root user, you may need to reset the root password directly in the MySQL database. You can do this by following these steps:

1. Stop the MySQL service.
2. Start the MySQL service in safe mode with the --skip-grant-tables option. This will allow you to access the MySQL database without authentication.
3. Log in to the MySQL database as the root user without a password by running the following command:
mysql -u root
4. Update the root user's password by running the following SQL query:
UPDATE mysql.user SET authentication_string=PASSWORD('new_password') WHERE User='root';
FLUSH PRIVILEGES;
5. Exit the MySQL database and restart the MySQL service.

After resetting the root password in the MySQL database, try logging in again with the new password.

If you are still experiencing issues, it is recommended to consult the MySQL documentation or seek assistance from a database administrator.

Rate this post

5 of 5 based on 7374 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us