Accessing and starting MySQL console in Xampp
We have to access the MySQL console in LInux so first we have to start the MySQL database in Xampp
The command is given below to start the MySQL
Just start mysql using the command
sudo /opt/lampp/lampp startmysql
here /opt/lampp is the directory where the lampp or Xampp server is located
From the terminal type
mysql -uUSER -pPASSWORD DATABASE which is:
mysql The actual command to use mysql
-uUSER is what user will connect. The -u is the parameter for the user and the USER part is the actual name of the user.
-pPASSWORD is the password for that user. the -p is the parameter for the password and the PASSWORD is the actual password.
the DATABASE part is optional. Is just if you want to connect directly to a particular database. For example, let us say the user cyrex with password ubuntu wants to connect to the database linux, you would type this:
mysql -uroot -p123456 linux (User is root, password is 123456 and the database is linux)
if you do not add the database you can eventually go to it by using the use statement of mysql or searching for the database with show databases;
To have a full path to start the MySQL in a consoole type the below example in your terminal
Examplelocalhost@user ~ $ /opt/lampp/bin/mysql -uroot -p123456 linux
After typing the above command you will get the terminal output as
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.5.27 Source distribution
Copyright (c) 2000, 2011, 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
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
After getting the console to have a check type
To check databases type
mysql> show databases;
To check tables type
mysql> show tables;
Thank you for reading