Linux mysql5.5

Source: Internet
Author: User
Tags check character

1. Assume that there are already mysql-5.5.10.tar.gz and cmake-2.8.4.tar.gz two source files

(1) Install CMake First (mysql5.5 is compiled by CMake later)

 [[email protected] rhel5 local]#tar -zxv-f cmake-2.8 . 4 . tar  .gz[[email protected] rhel5 local] #cd cmake - 2.8 . 4  [[email protected] rhel5 cmake -2.8 . 4 ] #./configure[[email protected] rhel5 cmake - 2.8 . 4 ] #make  2.8 . 4 ] #make  install  

(2) Create a MySQL installation directory and database storage directory

[Email protected] rhel5~]#mkdir -p/usr/local/mysql                 //[email protected] rhel5~]# mkdir -p/usr/local/mysql/data            // Storage Database

(3) Create MySQL users and user groups

[[email protected] rhel5~]groupadd mysql[[email protected] rhel5~]useradd-r-g MySQL MySQL

(4) Installing MySQL

[Email protected] rhel5 local]#Tar-zxv-f mysql-5.5.Ten.Tar. Gz[[email protected] Rhel5 local] #cd MySQL-5.5.Ten[[email protected] rhel5 MySQL-5.5.Ten] #cmake. -dcmake_install_prefix=/usr/local/MySQL-dmysql_datadir=/usr/local/mysql/Data-ddefault_charset=UTF8-ddefault_collation=Utf8_general_ci-dextra_charsets= All-denabled_local_infile=1[[email protected] rhel5 MySQL-5.5.Ten]# Make[[email protected] rhel5 MySQL-5.5.Ten]# Make Install

Parameter description:

-dcmake_install_prefix=/usr/local/mysql//installation directory

-dinstall_datadir=/usr/local/mysql/data//Database storage directory

-ddefault_charset=utf8//using UTF8 characters

-DDEFAULT_COLLATION=UTF8_GENERAL_CI//Check character

-dextra_charsets=all//Install all extended character sets

-denabled_local_infile=1//Allow import of data from local

Precautions:

When you recompile, you need to clear the old object file and cache information.

make RM-rm -rf/etc/my.cnf 

2. Configuration

(1) Set directory permissions

[Email protected] rhel5~]# cd/usr/local/chown -R root:mysql. // set the owner owner of all files in the current directory to root, and the owning group is MySQL  chown -R mysql:mysql Data

(2)

CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF // add MySQL start-up service to system service

(3) Create a table for the system database

[Email protected] rhel5 mysql]# cd/usr/local/mysql[[email protected] rhel5 mysql]# scripts/mysql_install_db- -user=mysql

(4) Setting environment variables

vi /root/. Bash_profile in Path= $PATH: $HOME/Bin add parameter is: PATH= $PATH: $HOME/bin:/usr/local/ mysql/bin:/usr/local/mysql/lib[[email protected] rhel5~] #source/root/.bash_profile

(5) manually start MySQL

[Email protected] rhel5~]# cd/usr/local/mysql[[email protected] rhel5 mysql]#. // start MySQL, but not stop The startup log is written under this file:/usr/local/mysql/data/-u root-p shutdown // Here the root user of MySQL has not configured the password, so it is null. If you need to enter a password, just click Enter. 

(6) Another simple way to start MySQL (MySQL has been added to the system service)

[[email protected] rhel5~]# service mysql.server start  [[email protected] rhel5~]# Service mysql.server stop[[email protected] rhel5~cp Support-files/mysql.server  /etc/init.d/mysql // add MySQL startup service to System Services Note: The main is to copy the Mysql.server to/ ETC/INIT.D, named MySQL. In some systems, Mysql.server is in/usr/local/mysql/share/mysql/mysql.server, and in this system, mysql.server in/usr/local/mysql/ Support-files/in Mysql.server. Then use #service MySQL start to start MySQL. 

(7) Change the password of the root user of MySQL and open the remote connection

[email protected] rhel5~]# MySQL-u root mysqlmysql>Use mysql;mysql>desc User;mysql> GRANT All privileges on * * to Root@"%"Identified by"Root";//the ability to add remote connections for root. Mysql>update user Set Password = Password ('xxxxxx') Where user='Root'; MySQL>SelectHost,user,password from User where user='Root'; MySQL>Flush Privileges;mysql>exit log in again: MySQL-U Root-p If the remote connection cannot be made, turn off the firewall [email protected] rhel5~]#/etc/rc.d/init.d/iptables Stop

Note: If you cannot connect remotely, error MySQL error number 1130, then add the following statement to try:

Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' ****** ' with GRANT OPTION;

Linux mysql5.5

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.