I am trying to access mysql from my mac's terminal.
I have tried just typing
mysql -u root -p
(and Enter, but that does not exist..)
This is what I have managed to do/located so far:
Williams-iMac:mysql noName$ cd /Applications/xampp/xamppfiles/var/mysql/mysql
Williams-iMac:mysql noName$ ls
This is what is located there.
columns_priv.MYD help_relation.frm slow_log.CSV
columns_priv.MYI help_topic.MYD slow_log.frm
columns_priv.frm help_topic.MYI tables_priv.MYD
db.MYD help_topic.frm tables_priv.MYI
db.MYI host.MYD tables_priv.frm
db.frm host.MYI time_zone.MYD
event.MYD host.frm time_zone.MYI
event.MYI ndb_binlog_index.MYD time_zone.frm
event.frm ndb_binlog_index.MYI time_zone_leap_second.MYD
func.MYD ndb_binlog_index.frm time_zone_leap_second.MYI
func.MYI plugin.MYD time_zone_leap_second.frm
func.frm plugin.MYI time_zone_name.MYD
general_log.CSM plugin.frm time_zone_name.MYI
general_log.CSV proc.MYD time_zone_name.frm
general_log.frm proc.MYI time_zone_transition.MYD
help_category.MYD proc.frm time_zone_transition.MYI
help_category.MYI procs_priv.MYD time_zone_transition.frm
help_category.frm procs_priv.MYI time_zone_transition_type.MYD
help_keyword.MYD procs_priv.frm time_zone_transition_type.MYI
help_keyword.MYI servers.MYD time_zone_transition_type.frm
help_keyword.frm servers.MYI user.MYD
help_relation.MYD servers.frm user.MYI
help_relation.MYI slow_log.CSM user.frm
But i still don't know how to access the mysql, so that i can create a new database (without doing it i phpmyadmin). I have created a new database in phpmyadmin though, just to try enter:
mysql -u root -p (my_phpmyadmin_created_database)
..but without any success.
Go to your XAMPP folder, wherever you set it up during installation (Applications is the default), and then to the xamppfiles folder, and then phpmyadmin. Once you open up phpmyadmin, find the file config. inc.
At the OSX Terminal prompt you enter mysql -u root to actually start the command line client that connects to the server. shell> represents whatever your shell prompt actually looks like. You do not enter this in after you have already typed mysql at the command line prompt.
/Applications/xampp/xamppfiles/bin/mysql -u root -p
Worked like a charm!
Thanks to user: Wrikken!
I usually do this to activate php and mysql from terminal with XAMPP 1.7.3(and probably above) on Mac
1. Go to Terminal
2. Enter which php: If it says /usr/bin/php, then proceed to 3.
3. Enter sudo nano ~/.bash_profile (or sudo vim ~/.bash_profile if you know how to use it)
4. Then paste this export PATH="/Applications/XAMPP/xamppfiles/bin:$PATH"
5. Ctrl - O then enter to save, then ctrl - X to exit.
6. Type cd ~
7. type . .bash_profile
8. Restart terminal.
9. Enter which php: If you did it right, it should be the same as the path in #4.
I'm just a new xampp user. I am also trapped by this question. Yes, the right directory is
/Applications/XAMPP/xamppfiles/bin/(the newest xampp is uppercase)
but when you connect to db, you should type
./mysql -u root -p (if there's password),
not input
mysql -u root -p...
directly, it wordked successfully on my macbook pro.
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