简体   繁体   中英

PHP MySQL WAMP - Database Error

When I launch the website through local host, I get the following error:

Database Error: Unknown database 'db_name'

I'm having a dig around as to what the problem is. The website belongs to a friend of mine and he wants me to connect the website to the database. The database resides within the root directory. I'm merely trying to connect to it.

In most of the PHP files, there is a tag that includes the config file which contains the details of the database.

Any ideas as to how I can get it working and resolve the Database Error: Unknown database 'db_name' error?

Any help is highly appreciated.

Database should not reside in root directory, it should be imported to database (Mysql) server.

Check in Mysql databases, does your database resides there? If not, you can do so by phpMyAdmin or navigating to your mysql and importing it.

Create database in mysql and import the sql file as below by opening command-line terminal:

/path/to/mysql/bin > mysql -u username -p < /path/to/root/db.sql

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