Reputation: 1
I installed xampp, I've run mysql and apache, but when I access to phpmyadmin gives me error # 1045.I've tried different things like going to the configuration file of phpmyadmin and change some settings but nothing changes. The problem is that before it went, but then I set the local root user for a random psw and I do not know, and from there it gives me access denied to the localhost. Is there a way to be able to solve this problem!?
Very important!! HELP ME!!
Upvotes: 0
Views: 3430
Reputation: 181
The first thing you need to do is revert the changes you did in config.inc.php. Make sure the root settings looks like this
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
Use the following procedure to reset the root password for localhost:
Start the xampp control panel as an administrator and stop mysql
Create a text file containing the following statements. Replace the password with the password that you want to use.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
Write the UPDATE and FLUSH statements each on a single line. The UPDATE statement resets the password for all root accounts, and the FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.
Save the file. For this example, the file will be named C:\mysql-init.txt.
Start cmd as an administrator. Go to Start. Type cmd. Right click on cmd. Then click on run as administrator.
Start the MySQL server with the special --init-file option. To do this use the following command.
C:\xampp\mysql\bin\mysqld.exe --init-file=C:\mysql-init.txt
If you installed xampp to a location other than C:\xampp, adjust the command accordingly.
The server executes the contents of the file named by the --init-file option at startup, changing each root account password.
You can also add the --console option to the command if you want server output to appear in the console window rather than in a log file. But this is optional.
After the server has started successfully, delete C:\mysql-init.txt.
Stop the MySQL server, then restart it normally using xampp control panel (as an administrator). After that you can access mysql through phpmyadmin using your new password.
EDIT
If it doesn't work and you have installed mysql as a service. Try uninstalling mysql service and repeat the steps.
Upvotes: 1