MySQL Clients: Client Access

This entry is part 1 of 8 in the series MySQL Clients

This series is a short introduction to using PHPMyAdmin or Toad for MySQL to access MySQL DB.

In an earlier post, I have mentioned about downloading WAMP server and install it into your PC.  With WAMP, you will get an Apache web server, PHP, MySQL and also PHPMyAdmin.

PHPMyAdmin is a web based client access to MySQL.  As it is web based, it is not as user-friendly as other client access programs such as HeidiSQL and Toad for MySQL.

We will use Toad for MySQL throughout this tutorial but first, let’s go through some simple steps where you could create a database and a table using PHPMyAdmin.

MySQL Clients: PHPMyAdmin

This entry is part 2 of 8 in the series MySQL Clients

First, start the WAMP server and make sure that it appears in the far right of the task bar in your Windows Desktop.

Click on it and look for PHPMyAdmin.  Start PHPMyAdmin and you will be brought to localhost/phpmyadmin in the web browser.

phpmyadmin

If this is the first time you have started using PHPMyAdmin, login as root without a password.  You will be brought to this page.

phpmyadmin1

Create Database

Click on Databases tab.

database

We will now create a database called allartist.  Type in allartist in the create database textbox and click on create.  A database allartist will be successfully created.

Create A Table

Using the code below, we will now create a table.

CREATE TABLE artist
    (
 id int auto_increment primary key, 
 artiste varchar(30), 
 album varchar(50),
 price decimal(3, 2) 
 );
 
INSERT INTO artist
(artiste, album, price)
VALUES
('Rod Stewart', 'Maggie May', 8.90 ),
('New Order', 'Substance', 7.50),
('Nirvana', 'Smell Like Teen Spirit', 9.80);

First click on allartist on the left column of the page.  Click on SQL and paste the code to the SQL query box.  Click on Go.

createtable

Go back to SQL tab and use the following query to display the table.  

select * from artist

A page will be shown as below.

query1

MySQL Clients: Toad for MySQL

This entry is part 3 of 8 in the series MySQL Clients

Now that we have created a database and a table artist using PHPMyAdmin, we will move on to using Toad for MySQL to access the database we have created.

Please download Toad for MySQL here.

Launch Toad for MySQL.

toad

Make sure that WAMP server is also started in your PC.  From Toad, we need to make a connection to the database allartist.

Click on File -> New -> Connection.  Type in the necessary information as shown in the screenshot.

toadconnection

Click on connect and you should be able to see the database allartist on the left column.

toadconnection1

You now have made a successful connection to the database allartist.

MySQL Clients: Query DB

This entry is part 4 of 8 in the series MySQL Clients

Let’s make a simple query through Toad.

select * from artist

From the menu, go to Tool -> Editor.

Type in the above query and execute the sql.

toadquery

Let’s end this tutorial by dropping the table and the database.  In our next tutorial, we will create again the database and table using PHP.

Execute the below 2 sql scripts to remove the table and the database.

drop table artist
drop database allartist

You can verify if you have removed the database successfully by login in using PHPMyAdmin.

MySQL Clients: Using the console

This entry is part 5 of 8 in the series MySQL Clients

MySQL provides a command line console and you can launch it from a path similar to below if you have installed WAMP server in  the C drive.

c:\wamp\bin\mysql5.6.12\bin\mysql.exe

mysql_console

You can also find the console at the mini task bar on the bottom right side of the desktop.

Once you have launched it, you will be prompted to enter the root password.  At the moment, there is no password set for my WAMP server.