如何使用 xampp 从 mac 终端访问 mysql?

2021-12-28 00:00:00 macos terminal xampp mysql phpmyadmin

我正在尝试从我的 mac 终端访问 mysql.

我试过只打字

<块引用>

mysql -u root -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.CSVcolumns_priv.MYI help_topic.MYD slow_log.frmcolumns_priv.frm help_topic.MYI tables_priv.MYDdb.MYD help_topic.frm 表_priv.MYIdb.MYI 主机.MYD 表_priv.frmdb.frm 主机.MYI time_zone.MYDevent.MYD host.frm time_zone.MYIevent.MYI ndb_binlog_index.MYD time_zone.frmevent.frm ndb_binlog_index.MYI time_zone_leap_second.MYDfunc.MYD ndb_binlog_index.frm time_zone_leap_second.MYIfunc.MYI plugin.MYD time_zone_leap_second.frmfunc.frm plugin.MYI time_zone_name.MYDgeneral_log.CSM plugin.frm time_zone_name.MYIgeneral_log.CSV proc.MYD time_zone_name.frmgeneral_log.frm proc.MYI time_zone_transition.MYDhelp_category.MYD proc.frm time_zone_transition.MYIhelp_category.MYI procs_priv.MYD time_zone_transition.frmhelp_category.frm procs_priv.MYI time_zone_transition_type.MYDhelp_keyword.MYD procs_priv.frm time_zone_transition_type.MYIhelp_keyword.MYI servers.MYD time_zone_transition_type.frmhelp_keyword.frm servers.MYI user.MYDhelp_relation.MYD servers.frm user.MYIhelp_relation.MYI slow_log.CSM user.frm

但我仍然不知道如何访问 mysql,以便我可以创建一个新数据库(我 phpmyadmin 没有这样做).我在 phpmyadmin 中创建了一个新数据库,只是为了尝试输入:

<块引用>

mysql -u root -p (my_phpmyadmin_created_database)

..但没有任何成功.

解决方案

/Applications/xampp/xamppfiles/bin/mysql -u root -p

像魅力一样工作!

感谢用户:Wrikken!

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.

解决方案

/Applications/xampp/xamppfiles/bin/mysql -u root -p

Worked like a charm!

Thanks to user: Wrikken!

相关文章