Install MySql in Linux

Source: Internet
Author: User

1. Install with yum

Yum install mysql-Server
# Yum-y install PHP-MySQL

2. Change the password

Vim/etc/My. CNF
[Mysqld]
Add the following here: Set the default value to utf8.
Default-character-set = utf8

Add the following statement at the end of the configuration file:
[MySQL]
Default-character-set = utf8

3. Start the MySQL Service

Set the MySQL service to start with the System
[Root @ fangsh ~] # Chkconfig mysqld on
Check that MySQL is self-started.
[Root @ fangsh ~] # Chkconfig -- list mysqld
Mysqld 0: off 1: off 2: On 3: On 4: On 5: on 6: Off (if 2--5 is on, it is OK)
Start MySQL Service
[Root @ sample ~] # Service mysqld start

Initializing MySQL database: [OK]
Starting MYSQL: [OK]

After starting the service, you are prompted to change the password. Of course, no password is required.

--------------------------------------------------------------------------

4. log on

After MySQL is installed, if the root user is not set a password. You can log on as follows:

[Root @ fangsh ~] # Mysql-u root (use the root user to log on to the MySQL server)

Password setting is available.
[Root @ fangsh ~] # Mysql-u root-P (and then renew the password)

Welcome to the MySQL monitor. commands end with; or \ G.
Your MySQL connection ID is 2 to server version: 4.1.20

Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Finally, you can view the user information as follows. Of course, the password is encrypted.
Mysql> Select User, host, password from mysql. user;

-- End

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.