Corey Ganser > Technology > Intro to MySQL

Intro to MySQL

Table of contents
No headers

Here is an introduction to MySQL with common commands that I use to view, update, and delete components within MySQL.

 

To login to MySQL use the following command:

 mysql -u username -p database

Replace the username with the username for your login to MySQL. Replace the database with the name of the database that you want to log into.

This will then prompt you for a password which is the password associated with the username that you put in.

Once you enter your password hit enter and you will get the following prompt:

mysql>

This is the prompt for MySQL where you will enter the commands for your database.  Note: after every command in MySQL make sure you have a semicolon otherwise it will not execute.  

 Explore your MySQL db by typing the following to show what tables are within your database

SHOW TABLES;

 

Change the MySQL password - replace my_password with the password

 mysql -u root -e "set password=PASSWORD('my_password')"

If you currently have a password for MySQL then you would run the following command, replacing the bold password with your current password and the my_password with the password you want to change it to:

 mysql -u root -ppassword -e "set password=PASSWORD('my_password')"
Tag page
You must login to post a comment.