Compile and install MySQL in Linux

Source: Internet
Author: User

1. Create a mysql user and user group (it seems that installation is not affected if the user is not created, but security needs to be re-planned ).

2. Compile and install (-- prefix =/usr/local/mysql -- with-charset = utf8 specifies the directory to be installed and the encoding to be used ).

3. initialize the database (mysql_install_db -- user = mysql). This database must be initialized. It is easy for cainiao to forget that if it is not installed, mysqld_safe cannot be started and some inexplicable errors will be reported.

4. Start mysql (mysqld_safe &)

5. set the password for the root user (mysqladmin-u root password 123456). This password is easy for cainiao to mix with mysql logon commands. Here, the password parameter is set to password, the password parameter used for logon is-p (for example, 6 ).

6. log on to mysql (mysql-u root-p) and press enter to enter the password.

7. mysql basic commands (the end can be fully executed with a semicolon,> Yes prompt)

> Show databases; // view all databases in mysql

> Use test; // switch to the test database for operations

> Show tables; // view all tables in the current database

> Create database gaso; // create a new database named gaso

> Select version (); // view the mysql version

> Use gaso;

> Create table gasotab (I int );

> Insert into gasotab values (6688 );

> Select * from gasotab; // create a test table in the gaso database. Insert the value and view the result.

> Show processlist; // view the mysql session List

> Show variables like 'character \ _ set \ _ % '; // view the character set used by 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.