Home > System Tutorial > LINUX > body text

Centos7.3 Mariadb database export and import commands

王林
Release: 2024-07-21 10:20:58
Original
370 people have browsed it

Centos7.3 Mariadb 数据库导出、导入命令

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
Copy after login

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.

Option 1
MariaDB [(none)]> create database renwole; //建立空数据库名
MariaDB [(none)]> use renwole; //选择数据库
MariaDB [(none)]> set names utf8; //设置数据库导入编码
MariaDB [(none)]> source /home/renwole.sql; //导入数据(注意sql文件的路径)
Copy after login
Option 2
# 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>
Copy after login

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!

source:linuxprobe.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!