How to Connect MySQL Server
Connecting to MySQL Using the MySQL Command-Line
Connect to MySQL server typically comes bundled with a console client designed for managing databases. On Windows, you can easily find the MySQL Command Line Client in the Start menu. It’s worth noting that the client is installed in two variants – one with Unicode support and the other without.
1.Locate the MySQL Command-Line Client
2.Run the Client MySQL
When you start the MySQL Server Command-Line Client, a command prompt window will open, asking you to input a password to connect MySQL Server.
3.Enter Your Password to Connect MySQL Server
To access MySQL from the command line, input the password set for the root user during the MySQL installation. Upon a successful connection, you’ll encounter output similar to the following:
4.Get a List of MySQL Databases
To See databases execute the command “show databases” to retrieve a list of databases hosted on your MySQL Server.
5.Create a Database in MySQL Server
In this step we are creating a new database, employ the “create database” followed by the database name you want, and press enter, you will get a message – query ok, 1 row affected.
6.Select the Database You Want to Use
To establish a connection with a specific MySQL database, use the “use” command followed by the database name at the MySQL prompt and press enter you will get a message database changed.
7.Create a Table and Insert Data
Generate a table within your database and insert data into it using the “create table” (table name) with columns and values dividing with ” , ” and press enter,
Next step Insert database Use command “insert into” followed by table name and column names in brackets then type values in brackets and press enter you will get a message ( Query OK, 1 row affected )
Next step, Enter Command Select * From “table name” and press enter to check the database you have created and successfully connected.
8.Concluding the MySQL Command-Line Client Session
To exit the MySQL client, type “quit” at the prompt and press Enter.