简体   繁体   中英

After running "$ mysql -u root -p", it returns "No such file or directory"

In my local terminal, after running:

mysql -u root -p

it returns:

bash: /usr/local/mysql: No such file or directory

Yes, I have installed everything as:

(envir) MBPganghinanban:ADB_nov20_2021 xxx$ brew services stop mysql
Stopping `mysql`... (might take a while)
==> Successfully stopped `mysql` (label: homebrew.mxcl.mysql)
(envir) MBPganghinanban:ADB_nov20_2021 xxx$ mysql.server start
Starting MySQL
. SUCCESS! 
(envir) MBPganghinanban:ADB_nov20_2021 xxx$ mysql.server stop
Shutting down MySQL
. SUCCESS! 

The part I suspect is that I have executed this previously:

alias mysql=/usr/local/mysql

In addition, it also returns "No such file or directory" if I run:

mysql

I am not sure of not being able to execute "mysql -u root -p" while being able to login to the server. Please help.

Thanks to the community. I have followed the instruction from Cid, meanwhile I have used:

which mysql

Hence, I found the path of my installation is at: /usr/local/bin/mysql Then

export PATH="/usr/local/bin/mysql”

The problem is solved!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM