#/Etc/init. d/mysqld start
Start MySQL
If you use this command for the first time, your/var/lib/mysql database will be created.
# Mysql-u root
You do not need to enter a password for the first time.
It is better to add a password to prevent intrusion.
The mysql command must be followed by ";" to be executed. (Press Enter to skip the line)
Most of the commands are the same as SQL commands, so you only need to paste them on the window.
To leave, just enter quit.
Mysql> quit
# Mysqladmin-u root password 'Password'
From then on, MySQL's root account will need a password!
As follows:
# Mysql-u root-p
Password: password
Mysql> update user set password = password ('Password') where user = 'root ';
Set the root password.
Mysql> show databases;
Show all databases.
Mysql> use database's name;
Select the specified database.
Mysql> show tables;
Show all tables in database.
#/Etc/init. d/mysql stop
Turn Off MySQL.