mysql error : not accessible as a command

mysql error : not accessible as a command

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 时,它显示 command not found。 现在,我应该如何访问 mysql

当我尝试这个时:

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>

正在运行。 为什么我不能通过在 command

中输入 mysql 直接访问它

试试这个

cd /opt/lampp/bin

./mysql

首先进入安装mysql的bin目录。 然后试试

./mysql

运行 终端上的这些命令:

 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>