MySQL无法连接-访问被拒绝(使用密码是) [英] Mysql cannot connect - Access denied (using password yes)

查看:697
本文介绍了MySQL无法连接-访问被拒绝(使用密码是)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有11点2所提供的托管服务,我刚刚创建了一个新的MySQL用户,并授予其对列出的每个操作的访问权限.

I have hosting provided by eleven 2 and I just created a new MySQL user and gave it access to every action listed.

我遇到以下错误

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
?>

我尝试按照此帖子的建议执行以下操作访问被拒绝用户"someuser" @"localhost"(使用密码:是)

I tried to do the following as suggested by this post Access denied for user 'someuser'@'localhost' (using password: YES)

GRANT ALL PRIVILEGES ON databasename.* TO 'bookorama'@'%' IDENTIFIED BY 'yourpassword';
FLUSH PRIVILEGES;

但是我收到以下错误#1044-用户的访问被拒绝".当我登录CPanel并签出数据库用户时,它显示了我尝试登录的用户,因此我对为什么它不起作用感到困惑.

But I got the following error "#1044 - Access denied for user". When I log into the CPanel and check out the database users, it shows the user that I tried to log in as, so I'm confused as to why it won't work.

编辑-我可以使用它.服务器出现问题.联系了房东,他们照顾好了.感谢您的答复.

推荐答案

我偶然发现了有关Cpanel

I stumbled upon this connection info about Cpanel http://www.inmotionhosting.com/support/community-support/databases/1045-access-denied-for-user-mysql-error

您的cPanel用户名和密码可用于连接到数据库(以及cPanel).如果要使用cPanel用户名和密码连接到数据库,则可以重置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.

如果您设置了专门用于访问数据库的MySQL用户名和密码,则需要确保在php脚本中使用了正确的用户名.例如,MySQL用户名始终采用以下格式:

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用户名_mysql用户名

cpanel-username_mysql-username

如果您的cPanel用户名是userna5,并且您创建的数据库用户名是dbuser1,那么实际的数据库用户名将是:

If your cPanel username is userna5 and you created a database username of dbuser1, then the actual database username would be:

userna5_dbuser1

userna5_dbuser1

暂时,建议您将您的数据库密码更改为您的Cpanel帐户密码,以消除任何疑问.

Temporarily, I'd suggest changing your databse password to that of your Cpanel account just to eliminate any doubts.

这篇关于MySQL无法连接-访问被拒绝(使用密码是)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆