Access denied for user ‘root’@’localhost’
Are you PHP/MySql programmer may be in your programmer life accidentily you came across following error :
“Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘root’@’localhost’ (using password: YES) in C:\xampp\htdocs\daytrader\login.php on line 4
Access denied for user ‘root’@’localhost’ (using password: YES) “
when you access your database using “root” as username, so you clearly open lot of security holes. Please avoid “root” as username when you accessing database in the mysql_connect() function.
mysql_connect(“localhost”, “root”, “”) or die(mysql_error());
Here is the simple solution to solve above problem :
So create new user to the particular database or table using following SQL query
GRANT ALL ON login.* TO ‘muni‘@’localhost‘;
Where login – Database name
muni – User Name
Localhost – Server Name.
Now access your database using username (muni), You had just created
mysql_connect(“localhost”, “muni”, “”) or die(mysql_error());
Download Premium Only Scripts & 80+ Demo scripts Instantly at just 1.95 USD per month + 10% discount to all Exclusive Scripts
If you want any of my script need to be customized according to your business requirement,
Please feel free to contact me [at] muni2explore[at]gmail.com
Note: But it will be charged based on your customization requirement