I want to run MYSQL from the command line, as in
mysql -u root -p
but it returns
-bash: mysql: command not found
So, need to install it, I think. But then what application exactly do I need to install? I see a dozen applications here: http://dev.mysql.com/downloads/
, installed some, but still can't use mysql from the command line.
I'm using mavericks. Thanks a lot
MySQL does not separate the server and client downloads, so you basically just need to download the entire MySQL version -- while it will download the binaries for the server it won't actually start or set-up a server unless you explicitly intend to.
You can go to the download URL (http://dev.mysql.com/downloads/mysql/) and select "Mac OS X" from platform and download "Mac OS X 10.7 (x86, 64-bit), DMG Archive"
The default MySQL installation installs to /usr/local/mysql
which is not in your path, specifically the MySQL client is installed at /usr/local/mysql/bin/mysql
You can specify it exactly to launch the client:
/usr/local/mysql/bin/mysql -u root
If you would like a GUI client I can highly recommend "Sequel Pro" or "MySQL Workbench"
I'll give you a workaround to achieve your wishes...
connect_to_my_sql.c
: #include <stdlib.h>
int
main() {
system("/usr/local/mysql/bin/mysql -u root");
}
gcc -o mysql connect_to_my_sql.c
mv mysql /usr/local/bin
mysql
everywhere from the terminal. Alternatively, create an Alias
like so:
vi ~/.bash_profile
alias mysql="/usr/local/mysql/bin/mysql -u root"
source ~/.bash_profile
mysql
everywhere from the terminal.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With