Changing from local to remote database
-
I am trying to figure out how to transfer an already created database in wordpress from the local wordpress server to a remote server.
After doing the changes the wordpress site gives “Error establishing a database connection”.
I can access the database from the server with the credentials without a problem.Both servers are in the same local network.
Wordpress server : 10.172.16.5
Database server : 10.172.16.6On the SQL server :
mysql -u wordpressuser -pmysql Ver 15.1 Distrib 10.3.12-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 Connection id: 39 Current database: Current user: wordpressuser@ SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server: MariaDB Server version: 10.3.12-MariaDB-1:10.3.12+maria~bionic mariadb.org binary distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 TCP port: /var/run/mysqld/mysqld.sock Uptime: 8 min 13 sec
On the wordpress server :
mysql -u wordpressuser -p -h 10.172.16.6mysql Ver 15.1 Distrib 10.3.12-MariaDB, for Linux (x86_64) using readline 5.1 Connection id: 40 Current database: Current user: wordpressuser@ SSL: Cipher in use is ECDHE-RSA-AES256-GCM-SHA384 Current pager: stdout Using outfile: '' Using delimiter: ; Server: MariaDB Server version: 10.3.12-MariaDB-1:10.3.12+maria~bionic mariadb.org binary distribution Protocol version: 10 Connection: 10.172.16.6 via TCP/IP Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8 Conn. characterset: utf8 TCP port: 3306 Uptime: 8 min 34 sec
I exported the database from the working wordpress installation with :
mysqldump -u wordpressuser -p wordpress > dbbackup.sql
And imported it to the new server with :
mysql -p -u wordpressuser wordpress < dbbackup.sql
config.php
/** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'wordpressuser'); /** MySQL database password */ define('DB_PASSWORD', 'password'); /** MySQL hostname */ define('DB_HOST', '10.172.16.6'); define( 'MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL );
- The topic ‘Changing from local to remote database’ is closed to new replies.