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.