PHP - MySQL access denied error - Works in other programs

那年仲夏 提交于 2019-12-02 03:15:49

You have 'root[SPACE]' as the user name. Try 'root' without the space?

Something is wrong with your credentials.

Verify the:

  • Username
  • Password
  • Host

Also, please stop using mysql_* functions as they are now deprecated. Use MySQLi or PDO instead.

Your connection should be like this

$link = mysql_connect('127.0.0.1:3307', 'mysql_user', 'mysql_password');

do not include http, add the port number to like in the example, check user name and password.

If will annoy you but each time you use a mysql_* function you'll get a PDO recommendation. I also recommend PDO, PHP also recomments PDO, you can check PHP Documentation for mysql_connect

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!