Php database problems

Source: Internet
Author: User
Tags php database
Php database problems php database, I usually directly Press everywhere data in PhpMyAdmin to directly copy the content to the SQL file, but you must first get a database during import, you can import the SQL file. if you do not have a database in advance, it will prompt you that this database is not available, is there any way to export the database and re-import it without creating the database first? Thank you for your php database questions.
Php database, I usually directly Press everywhere data in PhpMyAdmin to directly copy the content to the SQL file, but you have to get a database first during import, you can import the SQL file. if you do not have a database in advance, it will prompt you that this database is not available, is there any way to export the database and re-import it without creating the database first? Thank you.


------ Solution --------------------
Add these two lines at the beginning of the exported SQL file
Create if not extists database name;
Use database name;


In fact, PhpMyAdmin does not add these two lines to the SQL file, which is very user-friendly.
1. the database to which the table is imported depends on the database to which the table is imported. Prevents errors
2. you cannot set the database name for any rented space. most of them do not have the permission to create databases.
------ Solution --------------------
Edit your SQL file and write
Create database xxxx;
Use xxxx;
............

Save and then import.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.