Building of Lamp Environment (ii)----MySQL installation and configuration

Source: Internet
Author: User

MySQL is a free, open-source relational database.

Although MySQL was acquired by Oracle Corporation. But Oracle does not limit the development of MySQL.

MySQL is currently the most widely used relational database, and many large companies are using it. As of this publication, MySQL has been updated to version 5.7.

MySQL Installation:

1. Download the MySQL repo source

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2. Install the RPN package

sudo rpm-ivh mysql-community-release-el7-5.noarch.rpm

3. Install MySQL

sudo yum install mysql-server-y

4. Start MySQL

Start MySQL

Service MySQL Start

Initial startup may cause an error, possibly due to insufficient permissions.

ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)

Enter the following command to

sudo chown-r root:root/var/lib/mysql Change the owner of MySQL to the root user

5. Change the password

There is no password after installation, so log in directly to the root account

Mysql-u Root

mysql > Use MySQL;
MySQL > Update user set Password=password (' 123456 ') where user= ' root ';
MySQL > exit;

6. Change MySQL's default encoding to UTF8

The MySQL configuration file installed via Yum is saved in/etc/my.cnf

Vim/etc/my.cnf

Add the client and add the default encoding settings under MYSQLD

[Client]

Default-character-set = UTF8

[Mysqld]

Character_set_server = UTF8

Save ESC Input after writing: Wq carriage return

Be sure to restart the MySQL service after modifying the configuration file

Service MySQL Restart

Log in to MySQL input

Show variables like ' character% ';

As shown, this completes the installation of MySQL, modifies the password, and modifies the default encoding to UTF8. All configuration information for MySQL can be modified under/ETC/MY.CNF.

Building of Lamp Environment (ii)----MySQL installation and configuration

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.