Home > Article > System Tutorial > Centos7.3 Mariadb database export and import commands
There are many solutions for exporting mariadb database, generally using phpmyadmin or Navicat for MySQL, etc. I will demonstrate the commonly used command line mode.
They are; -u user, -p password, database name, > export path. Ending with .sql.
/usr/local/mysql/bin/mysqldump -uroot -p renwole > /home/renwole.sql
Enter the user password after pressing Enter. The export is successful and the file is under home.
Note: If you only export the table structure, add -d after -p.
There are 2 solutions for importing database.
MariaDB [(none)]> create database renwole; //建立空数据库名 MariaDB [(none)]> use renwole; //选择数据库 MariaDB [(none)]> set names utf8; //设置数据库导入编码 MariaDB [(none)]> source /home/renwole.sql; //导入数据(注意sql文件的路径)
# mysql -uroot -p renwole <p>It is recommended to use the second method to import, which is simple and fast, does not require setting the import encoding, and is less error-prone. The above solution is also applicable to any version of mysql&mariadb</p>
The above is the detailed content of Centos7.3 Mariadb database export and import commands. For more information, please follow other related articles on the PHP Chinese website!