I'm seeing a lot of of similar questions to this. but can't find one exactly like mine yet. Not sure where to change these settings or anything, any help appreciated.
access denied Access denied for user ''@'localhost' to database ''
This is the beginning of my page.
$dbhost = 'localhost'; //unlikely to require changing.
$dbname ='publication'; //modify these
$dbuser = 'username'; //variables
$dbpass = ''; //// to your installation
$appname = 'application name'; // and preference
mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
Use the ALTER USER command and change the authentication method to log into MySQL as root: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'insert_password'; This command changes the password for the user root and sets the authentication method to mysql_native_password.
You will get this error when the user user_name does not have the right to access your MySQL database. To resolve the error, you must create a user with the following command: mysql> GRANT ALL ON *. * to user_name@localhost IDENTIFIED BY 'password';
Try this: Adding users to MySQL
You need grant privileges to the user if you want external acess to database(ie. web pages).
You are most likely not using the correct credentials for the MySQL server. You also need to ensure the user you are connecting as has the correct privileges to view databases/tables, and that you can connect from your current location in network topographic terms (localhost).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With