Tech Support banner

Status
Not open for further replies.
1 - 2 of 2 Posts

·
Registered
Joined
·
1 Posts
Discussion Starter #1
I installed Apache on this PC months ago to test PHP files, but i never really used it, since i did most of my work at shcool.

But now i'm trying to test stuff on my computer. If i put my PHP files in my htdocs, i can navigate to them using my browser, but once i try to access a database, i get an error.

The code thats giving me the error is:
$dbconn=mysql_connect("localhost", "root", "abc") or die (mysql_error());

The error its giving me is:
Access denied for user 'root'@'localhost' (using password: YES)

the thing is i installed Apache so long ago, i don't remeber if thats the username and password i used. Where can i go to check that?
 

·
Registered
Joined
·
58 Posts
1. Stop MySQL



[[email protected] tmp]# mysqld stop

Stopping MySQL: [ OK ]

[[email protected] tmp]#



2. Start MySQL in Safe mode with the safe_mysqld command and tell it not to read the grant tables with all the MySQL database passwords.



[[email protected] tmp]# safe_mysqld --skip-grant-tables &

[1] 4815

[[email protected] tmp]# Starting mysqld daemon with databases from /var/lib/mysql

[[email protected] tmp]#



3. Use the mysqladmin command to reset the root password. In this case, you are setting it to ack33nsaltf1sh.



[[email protected] tmp]# mysqladmin -u root flush-privileges \

password "ack33nsaltf1sh"

[[email protected] tmp]#



4. Restart MySQL normally.



[[email protected] tmp]# service mysqld restart

Stopping MySQL: 040517 09:39:38 mysqld ended

[ OK ]

Starting MySQL: [ OK ]

[1]+ Done safe_mysqld --skip-grant-tables

[[email protected] tmp]#
 
1 - 2 of 2 Posts
Status
Not open for further replies.
Top