DirectAdmin Knowledge Base and Support

DirectAdmin is a web panel for a simple administration of both virtual and dedicated servers. DirectAdmin is faster, safe and more powerful than any other CP. And we know how to customize and support it.

How to manage SQL dumps in console on Directadmin server

| 20:59:32 07.12.2015

There are some ready tools to manage MySQL dumps in a console on Directadmin server. And here we'd like to say a couple of words about most useful of them.

Creating dumps

Custombuild 2 script has an option to dump all existing MySQL/MariaDB tables. It is suggested to enable it in case if you install/upgrade SQL server with custombuild. And even if you use repos of your OS to install and update database server, you still can use custombuild to create SQL dumps for any needs, and here is how you can do it:

cd /usr/local/directadmin/custombuild/
./build set mysql_backup yes
./build mysql_backup

All the created dumps will be moved into /usr/local/directadmin/custombuild/mysql_backups if it's not redefined in options.conf

Importing dumps

It's not a big deal to import one-two dumps into SQL server manually, but that might take a while to recover/restore a bulk of databases. To make things simpler Directadmin has a nice script: restore_sql_files.sh. In order to utilize the script and import all the databases run the following code:

cd /usr/local/directadmin/custombuild/mysql_backups
wget http://files1.directadmin.com/services/all/mysql/restore_sql_files.sh
chmod 755 restore_sql_files.sh
./restore_sql_files.sh

With this all databases will be restored from dumps for the exception of mysql.sql, performance_schema.sql and information_schema.sql. If you need the script to restore mysql table from the dump as well run the script with with_mysql flag:

./restore_sql_files.sh with_mysql

Using these two options you can do a MySQL migration from one server to another without much issues.

Good luck ;)

About Us
We are a team of professionals, and specialize in installation, configuring and managing of remote virtual and dedicated servers powered by Linux/Unix-like OS with DirectAdmin. We support various sets of software, including web-servers Apache, Nginx; internet domain name servers Bind, PowerDNS; mail-servers with POP3, IMAP and SMTP, FTP-servers, etc. After years of working through the most complex server challenges our team has gathered valuable experience and universal solutions suitable for everyday tasks. We are here to lend you a helping hand and take care of your servers in order to let you have enough time to do more of what you love.




All of the information and data on this site is for informational purposes only and is provided for the convenience of the user.
Powered by: Amiro.CMS - Free edition