I am trying to connect to a remote mysql database with my Symfony application. I don't want to install the mysql-server package on my server if I don't need to but when I try to connect, I get the following error:
[Doctrine\DBAL\Exception\ConnectionException]
An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[HY000] [2002] No such file or directory
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
Here's what my database configuration look like. In the variables, I setup pdo_mysql
as the driver and the other fields are working well.
doctrine:
dbal:
default_connection: default
connections:
default:
driver: %database.driver%
host: %database.host%
port: %database.port%
dbname: %database.name%
user: %database.user%
password: %database.password%
charset: UTF8
Edit1: If I install mysql-server, it works and the error is gone.
Edit2: My server is running Ubuntu 16.04.2 LTS
You should be able to install client on Ubuntu like this:
apt-get install mysql-client
I think 5.5 is the latest. Go here for setting up MariaDB: https://downloads.mariadb.org/mariadb/repositories/#mirror=syringa&distro=Ubuntu
makes more sense nowadays to use MariaDB instead:
EDIT #2
to add remote useron the remote system:
CREATE USER 'fooUser'@'192.168.40.200' IDENTIFIED BY 'myPassword';
check the user table to see if they can connect from remote system:
use mysql;
SELECT Host,User,Password,ssl_type from user;
ssl_type
is if you are using SSL to connect, you could leave that out.
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.