Import Mysql Database with Centos 7

Status
Not open for further replies.

Tango

Moderator
Staff member
4,044
2009
1,600
14,845
If your database is above 1GB it is worth while making a few tweaks to speed things up, Some large databases could take days with default settings & minutes with a few tweaks.

Install an editor if needed.

Code:
yum -y install nano

uAgVLWY.png


Code:
nano /etc/my.cnf.d/server.cnf

e7YUgKv.png


At the end of [mysqld] section add.
Code:
max_allowed_packet = 1G
net_buffer_length= 1G

Save the file CTRL+o, ENTER, CTRL+x
Restart Mysql to update config
Code:
service mysqld restart

Goto phpmyadmin and create a database eg. myforumbackup be sure to select the same charset as your old database used.

oMgSVXx.png


Goto the directory containing your database file, upload via FTP or Wget the file.

CbmPUHs.png

Code:
cd /home
ll

Import the database, this presumes you know mysql root password, you will be prompted to enter it.

is9Q3KR.png

Code:
mysql -uroot -p myforumbackup < myforumbackup.sql

Your database will now import, you can revert changes to my.cnf file when it's complete.
 
Status
Not open for further replies.
Back
Top