简体   繁体   中英

mysql php, connecting to localhost

I paid someone to develop a website for me. It has been about a week and the website has stopped working. I am trying to get in working on localhost but am confused as to what I should be doing.

I created a database on phpmyadmin called called mike but when I go to check if it works i get the error Access denied for user

define ("DB_HOST", "host.mywebistehub.com"); // set database host
define ("DB_USER", "mike"); // set database user
define ("DB_PASS","aB1287z600!"); // set database password
define ("DB_NAME","mike"); // set database name

$link = mysql_connect(DB_HOST, DB_USER, DB_PASS)
or die("Couldn't make  connection."); //this is line 17
$db = mysql_select_db(DB_NAME, $link)
or die("Couldn't select database");

The error message seems clear enough.

The username "mike" isn't allowed to access the database using the password you've given from the hostname of the machine you are running your code on.

You need to find out which of those three things are wrong and either change the permissions on your database or the credentials you are trying to connect with.


I am trying to get in working on localhost

define ("DB_HOST", "host.mywebistehub.com"); // set database host

host.mywebistehub.com is not localhost

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM