简体   繁体   中英

“Error establishing a database connection” Wordpress after I installed a new database

I was making a website through WordPress and everything was ok; the DB was on the port 3306. Two days ago, I had to install a DB on my pc for my job and it is on port 3306 so I changed the Wordpress's Db port into 3316 in my.ini but since then when I open my WP website it appears this: Error establishing a database connection

What else am I supposed to change?

It's important that the db of my job stays on port 3306

Try changing the MySQL port in wp-config.php ; WP is looking for the port there, rather than in my.ini.

Try:

For localhost:

define( 'DB_HOST', '127.0.0.1:3316' );

or in some cases:

define( 'DB_HOST', 'localhost:3316' );

For specified server:

define( 'DB_HOST', 'mysql.example.com:3316' );

See https://codex.wordpress.org/Editing_wp-config.php#MySQL_Alternate_Port

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM