简体   繁体   English

如何使用其他服务器上的wordpress数据库

[英]How to use a wordpress Database located on an other server

I need to use a Database locating in an other server for my wordpress site 我需要为我的wordpress网站使用位于其他服务器中的数据库

I changed this on my wp-config.php 我在wp-config.php上更改了它

/** MySQL hostname */
define('DB_HOST', '192.0.2.100');

and in the other computer I changed 在另一台电脑上,我改变了

Require local in phpmyadmin.conf to Rquire all granted in phpmyadmin.conf file but still i get this error when i try to open my site 需要phpmyadmin.conf中的local来获取phpmyadmin.conf文件中所有已授予的权限,但是当我尝试打开我的网站时仍然出现此错误

Error connecting to the database 连接数据库时出错

What should I do knowing tha im working on windows in both computers 我知道在两台计算机的Windows上都可以工作时该怎么办

change define('DB_HOST', '192.0.2.100'); 更改define('DB_HOST', '192.0.2.100'); to define('DB_HOST', 'localhost'); define('DB_HOST', 'localhost');

First of all, you'll need the database host, name, username and password to connect to mysql and not only the host. 首先,您需要数据库主机,名称,用户名和密码才能连接到mysql,而不仅是主机。

Furthermore, make sure the other server allows connecting to mysql remotely (check with your hosting provider). 此外,请确保其他服务器允许远程连接到mysql(请与您的主机提供商联系)。 To verify you can use apps like SequelPro to test the connection, and you'll need the following to connect: 要进行验证,您可以使用SequelPro之类的应用来测试连接,并且您需要进行以下连接:

  1. Host: database server IP 主机: database server IP
  2. Username: database user 用户名: database user
  3. Password: database user password 密码: database user password
  4. List item: Database name (optional if you want to directly select it after successfully connecting) 列表项: Database name (optional if you want to directly select it after successfully connecting)

If you've successfully connected, you'll need to apply these setting in your wp-config.php file: 如果成功连接,则需要在wp-config.php文件中应用以下设置:

/** The name of the database for WordPress */ define( 'DB_NAME', 'DB_NAME_USED ABOVE' );

/** MySQL database username */ define( 'DB_USER', 'DB_USER_USED_ABOVE' );

/** MySQL database password */ define( 'DB_PASSWORD', 'DB_PASS_USED_ABOVE' );

/** MySQL hostname */ define( 'DB_HOST', 'DB_HOST_USED_ABOVE' );

Cheers! 干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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