mysql error : not accessible as a command

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

I have installed XAMPP/LAMPP on my ubuntu 12.04 server. MySQL is running but when I type mysql in command it says command not found. Now, how should i access mysql

enter image description here

When i tried this :

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>

it is working. Why cannot i access it directly by typing mysql at command

2

There are 2 answers

0
Akash Chauhan On BEST ANSWER

Run these commands on terminal:

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

Now mysql has become a legal command on your system. you will get something like this :

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>
4
apm On

Try this one

cd /opt/lampp/bin

./mysql

OR

first goto the bin directory where mysql is installed. then try

./mysql