First check mysql related directories under linux
Check the installation path of mysql
Execute query SQL
< /p>
mysql>show variables like '%dir%';
datadir
is the data path
The running path is determined, and the import is executed , Export the mysql database command
One, use the mysqldump command to export the database
(Note: first cd to the mysql running path, and then execute the command):
1, export data And table structure:
mysqldump -u username -p password database name> database name.sql
Note that my server configuration permissions are special, so I need to use muysqldump -h 127.0.0.1 -u username- p password database name>the database name.sql named by yourself (this sentence is the same as the previous sentence, there is always one that suits you)
mysqldump -uroot -p dbname> dbname .sql
mysqldump- h 127.0.0.1 -uroot -p dbname> dbname .sql
After exporting, you can log in to ftp and find the sql file and download it directly, or use the scp command to download
After hitting enter, you will be prompted to enter the password
2, only export the table Structure
mysqldump -u username -p password -d database name> database name.sql
For example: mysqldump -uroot- p -d dbname> dbname .sql
Second, import the database1, first create a blank database mysql> create database dbname; 2, import the database Method one: (1) select the database mysql>use dbname; mysql>use hljz (2) set the database encoding mysql>set names utf8; (3) import data (pay attention to the path of the source/home/xxx) file x /dbname .sql; /home/xxxx/dbname.sql is the path of your database file on the server
mysql>show variables like '%dir%';
< /div>
mysql>show variables like ‘%dir%’;
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5110 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC