0

別のサーバーにあるデータベースに接続しようとしています:

コマンドライン

php symfony configure:database "mysql:host=<IP>;dbname=<db_name>" <username> <password>  

データベース.yml

  all:   
    doctrine:     
    class: sfDoctrineDatabase     
      param:       
      dsn: 'mysql:host=<IP>;dbname=<db_name>'
      username: <username>       
      password: <password>  

取得エラー:

PDO 接続エラー: SQLSTATE[HY000] [2002] 接続先が一定期間後に適切に応答しなかったため、接続の試行が失敗したか、接続されたホストが応答しなかったために確立された接続が失敗しました

4

2 に答える 2

0
Apologies for making this a bit long. 
This is the server my.cnf                                                           

[mysqld]
# Settings user and group are ignored when systemd is used (fedora >= 15).
# If you need to run mysqld under different user or group, 
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
user=mysql

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Semisynchronous Replication
# http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
# uncomment next line on MASTER
;plugin-load=rpl_semi_sync_master=semisync_master.so
# uncomment next line on SLAVE
;plugin-load=rpl_semi_sync_slave=semisync_slave.so

# Others options for Semisynchronous Replication
;rpl_semi_sync_master_enabled=1
;rpl_semi_sync_master_timeout=10
;rpl_semi_sync_slave_enabled=1

# http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html
;performance_schema


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
于 2013-02-08T12:22:27.247 に答える
0

そのホストからユーザーにアクセスを許可する必要があります。何かのようなもの

GRANT ALL ON mydb.* TO 'someuser'@'somehost';

詳細はこちら

于 2013-02-07T10:05:40.103 に答える