mysql错误:无法作为命令访问

时间:2015-06-24 06:32:45

标签: mysql ubuntu-12.04 lampp

root@vps:~# /opt/lampp/lampp startmysql
XAMPP: Starting MySQL...already running.
root@vps:~# mysql
-bash: mysql: command not found

我在我的ubuntu 12.04服务器上安装了 XAMPP / LAMPP 。 MySQL正在运行但是当我在命令中键入mysql时,它说命令未找到。 现在,我该如何访问mysql

enter image description here

当我尝试这个时:

root@vps:/bin# cd /opt/lampp/bin
root@vps:/opt/lampp/bin# ./mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.24 Source distribution

Copyright (c) 2000, 2015, 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>

它正在运作。 为什么我无法通过在命令 键入 mysql 直接访问它

2 个答案:

答案 0 :(得分:1)

在终端上运行以下命令:

 cd /bin
 ln  /opt/lampp/bin/mysql mysql
 mysql

现在 mysql 已成为您系统的合法命令。你会得到这样的东西:

root@vps:/# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.24 Source distribution

Copyright (c) 2000, 2015, 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>

答案 1 :(得分:0)

试试这个

  

cd / opt / lampp / bin

     

./ MySQL的

OR

首先转到安装了mysql的bin目录。 然后尝试

  

./ MySQL的