我正在尝试从我的mac终端访问mysql。
我试过打字
mysql -u根-p
(输入,但不存在.)
这就是我到目前为止设法做的/找到的:
Williams-iMac:mysql noName$ cd /Applications/xampp/xamppfiles/var/mysql/mysql Williams-iMac:mysql noName$ ls
这就是那里的位置。
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但是我仍然不知道如何访问mysql,这样我就可以创建一个新的数据库(不需要这样做,我就可以使用phpmyadmin)。不过,我在phpmyadmin中创建了一个新的数据库,只是为了尝试enter:
mysql -u root -p (my_phpmyadmin_created_database)
..but没有任何成功。
发布于 2012-12-15 15:57:09
/Applications/xampp/xamppfiles/bin/mysql -u root -p
很有魅力!
感谢用户: Wrikken!
发布于 2014-12-25 11:53:57
我通常这样做是为了在Mac上用XAMPP1.7.3(可能在上面)从终端激活php和mysql
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.发布于 2015-11-08 08:21:23
我只是个新的xampp用户。我也被这个问题困住了。是的,正确的目录是
/Applications/XAMPP/xamppfiles/bin/(the newest xampp is uppercase)但是,当连接到db时,应该键入
./mysql -u root -p (if there's password),非输入
mysql -u root -p... 直接的,它成功地在我的macbook上。
https://stackoverflow.com/questions/13892904
复制相似问题