DBngin icon indicating copy to clipboard operation
DBngin copied to clipboard

Can't use command line

Open stratboy opened this issue 3 years ago • 1 comments

  1. Driver (Ex: PostgreSQL 10.0): mysql 5723

  2. DBngin build number: Version 3.1 (32)

  3. macOS version: 10.14.6 (18G8012)

Hi, server from dbngin is green, running, and I can access it through tableplus. But I cannot use command line:

➜  ~ which mysql
/Users/Shared/DBngin/mysql/5.7.23/bin/mysql
➜  ~ mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
➜  ~ 

How to solve? This also is a problem for running laravel apps, since they should use mysql command.

I was able to use it with mysql --socket /tmp/mysql_3306.sock -uroot, but obviously, this is not what's needed to run laravel apps and others. I would need clean and direct mysql command. How to?

stratboy avatar Feb 21 '21 09:02 stratboy

Laravel would use whatever server you tell it to use in the .env file - so in this case the server in the .env file would be 127.0.0.1. To make the command line more comfortable, maybe add an alias to the shell. Something like alias connect_db="mysql -h127.0.0.1 -uroot" this might work, too: alias mysql="mysql -h127.0.0.1" add it to your shell configuration (e.g. ~/.zshrc) and it will be available any time you start a shell.

Another thing that might work is a symbolic link, something like ln -s /tmp/mysql_3306.sock /tmp/mysql.sock

To make php work with localhost, you can adjust the following settings: pdo_mysql.default_socket=/tmp/mysql_3306.sock mysqli.default_socket = /tmp/mysql_3306.sock

michael-grunewalder avatar Mar 12 '21 03:03 michael-grunewalder