How do I connect to a MySQL database over SSL with Laravel 5.3

后端 未结 3 1919
难免孤独
难免孤独 2020-12-20 08:38

I\'ve been searching all over the internet and haven\'t had any success.

eg: https://laravel.io/forum/06-18-2014-connecting-mysql-over-ssl?page=1 https://laracasts

3条回答
  •  一生所求
    2020-12-20 09:00

    Sometimes, the same error is displayed when you don't have permissions for access remotely to the database.

    example here:

    • Server1-app: 123.123.123.12
    • Server2-database: 456.456.456.45

    So, you can try from Server1-app:

    $ mysql -u youruser -h yourpassword;
    

    And into mysql terminal, check if you are able to access to the database:

    $ show databases;
    

    If your database is shown, you have privileges and everything is ok, if not, you must acces to your Server2-database and grant privileges to your user.

    Once in Server2-database;

    $ mysql -u root -p
    $ GRANT ALL PRIVILEGES ON your_database.* TO 'youruser'@'123.123.123.12';
    $ FLUSH PRIVILEGES;
    $ exit;
    

    Hope it be helpful;

提交回复
热议问题