我收到以下错误
Warning: MysqL_connect() [function.MysqL-connect]: Access denied for user '(username is here,removed for posting)' (using password: YES) in /home/.../public_html/config.PHP on line 10
这是我的配置文件
//connection details have been removed for posting purposes <?PHP define('sql_SERVER',''); // Database Server define('sql_USER',''); // User define('sql_PASS',''); // Password define('sql_DB',''); // database MysqL_connect(sql_SERVER,sql_USER,sql_PASS) or die("Error: ".MysqL_error()); // Connection to the server MysqL_select_db(sql_DB) or die("Error: ".MysqL_error()); // Connecting to the database ?>
我尝试按照这篇文章Access denied for user ‘someuser’@’localhost’ (using password: YES)的建议执行以下操作
GRANT ALL PRIVILEGES ON databasename.* TO 'bookorama'@'%' IDENTIFIED BY 'yourpassword'; FLUSH PRIVILEGES;
但我收到以下错误“#1044 – 用户拒绝访问”.当我登录到CPanel并检出数据库用户时,它会显示我尝试登录的用户,因此我很困惑为什么它不起作用.
编辑 – 我得到了它的工作.服务器出了问题.与主人联系,他们负责处理.谢谢你的回复.
Your cPanel username and password can be used to connect to your databases (as well as your cPanel). If you’re connecting to your database using your cPanel username and password,you can reset your cPanel password to ensure you are using the correct username and password.
If you setup a MysqL username and password specifically for accessing a database,you’ll want to ensure you are using the correct username in your PHP scripts. For example,MysqL usernames are always in this format:
cpanel-username_MysqL-username
If your cPanel username is userna5 and you created a database username of dbuser1,then the actual database username would be:
userna5_dbuser1
暂时,我建议将您的数据库密码更改为您的Cpanel帐户密码,以消除任何疑虑.