Thursday, September 28, 2017

Accessing MySQL / MariaDB console through Command Prompt

There are two ways to access to MySQL/MariaDB using Command Prompt or Shell Command.
first method is by click on the Shell button on the XAMPP Control Panel, which located on the upper right hand side of the control panel (as circled red in Figure 5).
Figure 5: Shell Button on XAMPP Control Panel
The second method required user to launch command prompt from start button (as shown in Figure 6).
Figure 6: Launching Command Prompt from Start Button (or Window Button).
To launch the command prompt press on start button (or window button) and type "cmd" or "command prompt", click on the command prompt to launch it. After launching the command prompt, the interface as in Figure 7 will appear.

Figure 7: Command Prompt in Windows
then navigate to the XAMPP folder in the local device using "cd.." and "cd" command in the command prompt. "cd.." command is use to navigate out of current folder, while "cd" is to navigate to a sub-folder. while "dir" will list the content of the current folder.

The MySQL/MariaDB console are usually located at C:\xampp\mysql\bin. The navigation to the folder is shown in Figure 8 below.
Figure 8: Navigate to the MySQL bin folder to access the MySQL console function.
After opening the Shell Console through XAMPP Control Panel or Navigated to the MySQL's bin folder using command prompt. Type "mysql" to launch the console. Figure 9 show the console in command prompt while Figure 10 show the console launched from Shell console.
Figure 9: MySQL / MariaDB console launched from Command Prompt.
Figure 10: MySQL / MariaDB console launched from Shell console in XAMPP Control Panel.