- Mysql-> create database dbname; // CREATE a DATABASE
- Mysql-> create table tablename; // CREATE a TABLE
- Mysql-> show databases; // displays the database information and available DATABASES.
- Mysql-> USE dbname; // select a database
- Mysql-> show tables; // displays the table information, available TABLES
- Mysql-> DESCRIBE tablename; // display the information of the created table
3. export database files from the database: 1. export the database mydb to e:/mysql/mydb. in the SQL file: Open Start-> run-> enter cmd to enter command line mode c:/> mysqldump-h localhost-u root-p mydb> e:/mysql/mydb. then, 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. 2. export mytable from mydb to e:/mysql/mytable. in the SQL file: c:/> mysqldump-h localhost-u root-p mydb mytable> e:/mysql/mytable. sql3. export the database mydb structure to the file "c:/mysql/mydb_stru. SQL": c:/> mysqldump-h localhost-u root-p mydb -- add-drop-table> e: /mysql/mydb_stru. SQL 4. import data from an external file to the database: import the SQL statements in the file into the database from e:/mysql/mydb2. SQL: 1. enter mysql from the command line, and then run the create database mydb2 command to CREATE the DATABASE mydb2. 2. to exit mysql, run exit or quit. 3. run the following command in CMD: c:/> mysql-h localhost-u root-p mydb2 <e:/mysql/mydb2. SQL and then enter the password. 5. solution to the import file size limit: by default, mysql imposes a limit on the size of the imported file, which is at most 2 MB. Therefore, when the file is large, it cannot be imported directly. Solution: 1. in php. modify related parameters in ini: There are three parameters that affect the mysql import file size: memory_limit = 128 M, upload_max_filesize = 2 M, post_max_size = 8 M modify upload_max_filesize = 200 M modify the size that meets your needs here, you can modify the other two memory_limit = 250 M post_max_size = 200 M In this way, the. SQL file below MB can be imported. |