大网数据广告活动
网站运营与故障问答

How to create user in phpmyadmin to connect two servers?

· 52CE 我爱测

IP my Website: 192.168.19.33 and IP Database server is: 192.168.19.41 . How to create user account in phpmyadmin for the connection between the two servers? And how to edit this setting: DB_CONNECTION=mysql DB_HOST=localhost DB_P…

问题原文

原帖链接 · mySun · CC BY-SA 3.0

IP my Website: 192.168.19.33 and IP Database server is: 192.168.19.41.

How to create user account in phpmyadmin for the connection between the two servers?

And how to edit this setting:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=website
DB_USERNAME=root
DB_PASSWORD=123456

to this setting:

DB_CONNECTION=mysql
DB_HOST=192.168.19.41
DB_PORT=3306
DB_DATABASE=website
DB_USERNAME=username
DB_PASSWORD=password

已采纳解答

原帖链接 · Michael Yaeger · CC BY-SA 3.0

Create the remote connection

To create a remote connection:

  1. On your database server, as a user with root privileges, open your MySQL configuration file.

    To locate it, enter the following command:

    mysql --help

    The location displays similar to the following:

    Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

  2. Search the configuration file for bind-address.

    If it exists, change the value as follows.

    If it doesn’t exist, add it anywhere except the [mysqld] section.

    bind-address = 192.168.19.33

  3. Save your changes to the configuration file and exit the text editor.

  4. Restart the MySQL service: service mysql restart


Grant access to a database user

To enable your web node to connect to the database server, you must grant a web node database user access to the database on the remote server.

This example grants the root database user full access to the database on the remote host.

To grant access to a database user:

  1. Log in to the database server.
  2. Connect to the MySQL database as the root user.
  3. Enter the following command:

    GRANT ALL ON website.* TO [email omitted] IDENTIFIED BY 'password';


Verify database access

On your web node host, enter the following command to verify the connection works:

mysql -u username -h 192.168.19.41 -p

If the MySQL monitor displays as follows, the database is ready for use by the website:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 213
Server version: 5.6.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Source: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/mysql_remote.html

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。