且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL无法连接-访问被拒绝(使用密码是)

更新时间:2023-12-01 20:36:10

我偶然发现了有关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.