Database access error Accessdeniedforuser & # x27; & # x27; @ & # x27; localhost & # x27; todatabase & # x27; xinjisudi & # x27; database connection error & nbsp; database Access error Access & nbsp; denied & nbsp; for & nbsp; user & nbsp; @ localhost & nb database Access error Access denied for user ''@ 'localhost' to database' xinjisudi'
Database connection error: database Access error: Access denied for user'' @ 'localhost' to database' xinjisudi'
Database Connection code
$ Conn = mysql_connect ("localhost", "", "") or die ("database server connection error". mysql_error (); // create a database connection
Mysql_select_db ("xinjisudi", $ conn) or die ("database access error". mysql_error (); // open the database
Mysql_query ("set names utf8"); // fix garbled characters
?>
What are your questions?
------ Solution --------------------
$ Conn = mysql_connect ("localhost ","","")
At least none of the usernames are available. if the password is empty, you can still
------ Solution --------------------
Resource mysql_connect ([string server [, string username [, string password [, bool new_link [, int client_flags])
It can be all default values (condition: user name: root, password: None)
If username is not default, it must be the correct user name.
------ Solution --------------------
Reference:
Resource mysql_connect ([string server [, string username [, string password [, bool new_link [, int client_flags])
It can be all default values (condition: user name: root, password: None)
If username is not default, it must be the correct user name.
If you want to set the default value, you should not enter ''. then you can directly write mysql_connect ('localhost.
------ Solution --------------------
It seems that your user does not have the xinjisudi database permission.
You must first use a root account and other management accounts to log on and authorize permissions.
------ Solution --------------------
Contact the administrator and ask him to assign a user name and password as well ..
------ Solution --------------------
Provide the user name even if there is no password.
------ Solution --------------------
The safest way is to create an account with a password and grant the account the permission to access a database.