Installing and configuring MySQL

Source: Internet
Author: User

This section describes how to install and configure MySQL.

1 Installing the MySQL database
This section takes mysql5.1.49 as an example of the installation process for MySQL databases.
Step 1 log in to the server as the root user.
Step 2 Upload the following packages of mysql5.1.49 to the "/tmp" directory using the tools such as SSH or xftp.

?   MySQL-client-community-5.1.49-1.rhel5.x86_64.rpm?   MySQL-server-community-5.1.49-1.rhel5.x86_64.rpm

Step 3 Enter the "/tmp" directory.

cd /tmp

Step 4 Install the MySQL server.

-ivh MySQL-client-community-5.1.49-1.rhel5.x86_64.rpm

Step 5 Install the MySQL client.

-ivh MySQL-server-community-5.1.49-1.rhel5.x86_64.rpm

Step 6 Please copy "/usr/share/mysql/mysql-server-community-5.1.49" to "/etc" directory and modify it to "my.cnf",
The directory here should be/usr/share/mysql/doc/mysql-server-community-5.1.49
In order not to degrade system performance, especially if the system memory is small as 1~2g, perform this step.

cp /usr/share/mysql/MySQL-server-community-5.1.49 /etc/my.cnf

--End
2 Configuring the MySQL Database
Normal configuration is required after MySQL is installed to use, this section describes the method of configuring MySQL.
Step 1 log in to the MySQL server as the root user.
Step 2 start the MySQL database.

start

The system displays the following information indicating that the boot was successful.

StartingMySQL                                             [确定]

Step 3 Set the user name and password.

-u‘root‘

If you have set the login password for the MySQL database, the system displays the information shown below.

toat‘localhost‘‘Access denied for user ‘root‘@‘localhost‘ (using password: NO)‘

Step 4 log in to MySQL.

-uroot-proot

Step 5 allows remote connection and refresh to take effect.

grant all on *.* to ‘root‘@‘%‘ identified by ‘root‘ WITH GRANT OPTION;FLUSH PRIVILEGES;

Step 6 Turn off Log_bin to avoid MySQL returning 1418 error codes.

SET GLOBAL log_bin_trust_function_creators = 1;

Step 7 exit MySQL.

exit

Step 8 Configure the character encoding for MySQL to Utf-8.
1. Open the "/etc/my.cnf" file.

vi /etc/my.cnf
    1. After pressing the "I" key to enter the editing state, see the following description of the configuration character encoding and the number of thread open tables.
      ? Set the client encoding format to Utf-8.
      In the information shown below, insert the Blue font section to set the client's encoding format to Utf-8.
[client]//password       = [your_password]port            3306socket          = /var/lib/mysql/mysql.sockdefault-character-set=utf8

? Set the service-side encoding format to Utf-8.
In the information shown below, insert the Blue font section to set the service-side encoding format to Utf-8.

genericconfiguration optionsdefault-character-set=utf8port            3306socket          = /var/lib/mysql/mysql.sock
    1. Restart MySQL to make the settings effective.
service mysql restart

--End
3 Detecting MySQL Database
Step 1 log in to the server as the root user.
Step 2 detects whether the MySQL database is started.

service mysql status

If not, start with the following command:

start

Step 3 detects if MySQL is booting with the system.

chkconfig--listmysql

If MySQL starts randomly, the following information is displayed:

mysql           0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

If the MySQL entry is not displayed, you need to enter a command to join the system's Startup service group:

chkconfig--addmysql

If you have "off" in 2~5, you need to start. For example, when 2 is a "off" state, it needs to switch to the "Start" state, please enter the following command:

chkconfig--level2mysqlon

Installing and configuring 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.