我在MariaDB中有一个远程数据库,该数据库不允许我进行超过我授予所有特权的连接
我的 .env 文件
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3307
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=''
ASTERISK_HOST=hostname
ASTERISK_PORT=3306
ASTERISK_DATABASE=asterisk
ASTERISK_USERNAME=lmorales
ASTERISK_PASSWORD=''
我的 config / database.php 文件
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3307'),
'database' => env('DB_DATABASE', 'test'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'modes' => [
'ONLY_FULL_GROUP_BY',
'STRICT_TRANS_TABLES',
'NO_ZERO_IN_DATE',
'NO_ZERO_DATE',
'ERROR_FOR_DIVISION_BY_ZERO',
'NO_ENGINE_SUBSTITUTION',
],
],
'asterisk' => [
'driver' => 'mysql',
'host' => env('ASTERISK_HOST', ''),
'port' => env('ASTERISK_PORT', '3306'),
'database' => env('ASTERISK_DATABASE', 'asterisk'),
'username' => env('ASTERISK_USERNAME', 'lmorales'),
'password' => env('ASTERISK_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
],
我的数据库配置是
主机是我在.env文件中配置的主机
如果我使用用户名和空密码登录mysql,则可以输入
但是从我的应用程序中,它会产生错误