1

有没有办法从 MySQL 命令行访问和管理我的 phpMyAdmin 上的数据库?

4

1 回答 1

2

假设 *nix 站上有一个类似 BASH 的外壳:

mysql -h<hostname> -u<username> -p<password>

本地主机可以跳过 -h。如果您正在处理远程主机,则必须将其配置为侦听外部接口,并且您必须能够访问远程主机上该接口上的端口 3306。用户名要么是 root,要么是特定于数据库/模式的东西,就像密码一样。

12:02:26 justin@justin-4320s:~
$ mysql -htiny -uroot -p################
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2710
Server version: 5.5.28-0ubuntu0.12.10.1-log (Ubuntu)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| Assessor           |
| mysql              |
| performance_schema |
| test               |
| ... contd.         |
+--------------------+
12 rows in set (0.10 sec)

mysql>
于 2012-11-17T20:31:12.810 回答