How to use MySQL on Linux

Source: Internet
Author: User
# Etcinit. dmysqldstart start MySQL if you use this command for the first time, your varlibmysql will create a database. # Mysql-uroot initial

#/Etc/init. d/mysqld start MySQL if you use this command for the first time, your/var/lib/mysql database will be created. # Mysql-u root initial

#/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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.