Export the XXsql file from sqllite. Import data to the mysql database. Type the command: sourcesmbworksmysqlsql
Migration between MySQL and SQLite _ MySQL
Import from sqlite database to mysql database instance
Export the file XX. SQL from sqllite. Import data to the mysql database.
Type the following command:
source /smb/works/mysql.sql
The following errors occur:
You have an error in your SQL syntax; check the manual thatcorresponds to your MariaDB server version for the right syntax to use near XXXXXXXXX
The reason is that sqllite differs greatly from mysql statements: MYSQL on the left and SQLite on the right.
1. start the transaction
Mysql is start transaction
Sqlite Is begin transaction
2. submit a transaction
Mysql is commit
Sqlite Is commit transaction
3. create a table
[] Is not required for the database name, table name, and table name of Mysql. [] is required for all sqlite names.
4. Data types
Mysql supports sqlite data types. However, sqlite defines that an error is reported when the range is imported into mysql. Only varchar needs to define a range.
5. conflict resolution
The ONCONFLICT clause of SQLite is not an independent SQL command. This is a non-standard clause that can appear in many other SQL commands. Not supported in Mysql.
Import data from a mysql database to an sqlite database instance
Step 1: mysql export the. SQL file
Enter
mysqldump -h localhost -u root -p mydb>e:\mysql\mydb.sql
Enter the password and wait for a moment until the export is successful. you can check whether the export is successful in the target file.
Step 2: run the command to open the database file.
Create the database file test. db in the current directory. if the database file exists, open the database file. If you want to modify the database file of another user, you can open the database file and modify it in this way. After the import is successful, it appears:
Step 3: Use the dabatabse command
You can save the database file corresponding to the library main as the file opened in step 2.
Step 4: modify the database
Use SQL statements to operate the database. If you migrate data from another database, use the SQL file exported from the database and open the SQL file in Notepad. the SQL statements of mysql and sqlite are different, you have a bidding document in the document "import from sqlite database to mysql database.
To create a database table and adjust the data structure, you can use the read command to read the SQL file after modifying the. SQL file. If there is an error, an error message is returned. If it is correct, it will be returned directly.
Step 5: confirm whether the modification is successful
Run the headers on command to turn on the table switch. then, run the SQL statement select to check whether the table content has been modified successfully.
Sqlite3 commands must be called in the form of ". XXX. Add "." before calling the command ".".
The SQL statement must be called in the form of "XXXXXXXXXX. Add ";" after the statement ends.
Sqlite command set:
Mysql command set
The above is the migration of MySQL and SQLite _ MySQL. For more information, please follow the PHP Chinese network (www.php1.cn )!