PHP - MySQL access denied error - Works in other programs

前端 未结 3 1067
一向
一向 2021-01-25 17:46
Access denied for user \'root \'@\'localhost\' (using password: YES)

Yes, this error is all too common, and I have spent much time researching it. How

3条回答
  •  余生分开走
    2021-01-25 18:00

    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

提交回复
热议问题