Mariadb
Install mariadb;
$ prt-get depinst mariadb
Check mariadb user and data directory;
$ getent passwd mysql | cut -f 6 -d : /srv/mariadb
If the data directory is not desired one;
# usermod -m -d /srv/mariadb mysql
Install data directory;
# mysql_install_db --user=mysql --basedir=/usr --datadir=/srv/mariadb
Start database;
# bash /etc/rc.d/mariadb start
Run mysql secure installation command and edit configuration;
$ sudo mysql_secure_installation $ sudo vim /etc/my.cnf
Comment line like this; #skip-networking, restart database server;
[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld] port = 3306 socket = /var/run/mysqld/mysqld.sock datadir = /srv/mariadb skip-external-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M #syslog #skip-networking bind-address = 127.0.0.1 [mysqldump] quick max_allowed_packet = 16M [mysql] [myisamchk] key_buffer_size = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout
$ sudo bash /etc/rc.d/mariadb restart
Dump database
For more information about mysqldump check information making backups with mysqldump
The quick way to dump / export;
mysqldump -u username -p database_name > data-dump.sql
To import;
mysql -u username -p new_database < data-dump.sql
The long way to export based on official documentation;
mysqldump --user=username --password --lock-tables --databases db1 > data-dump.sql