Problems with connection to the database

Asked

Viewed 59 times

1

I have an error that could not connect to database on line 125 in the file I will leave here.

'Cause they handed me a website but I don’t understand anything about you.

I have to call (for testing) the host: localhost; username: root; database:know; and has no password (I do not know if these data are accurate but I will put in anyway)

Can someone tell me what’s wrong?

PS: I’m very new on the link PHP and DB

1 answer

0


host: localhost

Indicates that the SQL server is on the same server as your site. So, if you are running a local test on your machine, you will not find the server. Ensure that code is running on the same database server.

username:root

I’m imagining that the database is Mysql, where the default username is root and no password (password). In this case it may be that someone has changed or created the password for the root user. Look for some Mysql-Front type tool that allows you to connect to the database to really know the connection data are OK.

  • I did that exactly: (var $username = 'root'; var $password = ''; var $hostname = 'localhost'; var $database = 'know';), but it’s still a mistake

Browser other questions tagged

You are not signed in. Login or sign up in order to post.