Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Anoud's avatar
Level 1

Laravel (Valet) problem with Mysql connection

Hi,

I installed valet and I created a new Laravel project and I tried to run MySQL so that I can create a new database. I typed:

mysql -uroot -p

But I keep receiving this error :

mysql: Can't read dir of '/usr/local/etc/my.cnf.d' (Errcode: 2 "No such file or directory")
Fatal error in defaults handling. Program aborted

This is my .env database part:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=questionnaire
DB_USERNAME=root
DB_PASSWORD=

I typed this line:

brew install mariadb

and then this line:

mysql.server start

but this what I get:

/usr/local/Cellar/mariadb/10.3.12/bin/my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (Errcode: 2 "No such file or directory")
Fatal error in defaults handling. Program aborted
Starting MariaDB
./usr/local/Cellar/mariadb/10.3.12/bin/my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (Errcode: 2 "No such file or directory")
Fatal error in defaults handling. Program aborted
/usr/local/Cellar/mariadb/10.3.12/bin/my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (Errcode: 2 "No such file or directory")
Fatal error in defaults handling. Program aborted
190212 14:47:53 mysqld_safe Logging to '/usr/local/var/mysql/Alanoud.local.err'.
190212 14:47:54 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql

/usr/local/bin/mysql.server: line 260: kill: (42073) - No such process ERROR!

Can anyone help me, please?

By the way, if I used my second PC and I typed:

mysql -uroot -p

it asks me for a password, I tried to click Enter, Also I tried my laptop password but didn't work. I will get this error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
0 likes
3 replies
Anoud's avatar
Anoud
OP
Best Answer
Level 1

Manage to make it work after reinstalling everything.

amrography's avatar

Mysql is not initialized. Open terminal then type

$ mysqld

Please or to participate in this conversation.