Linux installation mysql--source installation
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] [[email protected] rhel5 Local] [[email protected] rhel5 cmake-2.8.4] [[email protected] rhel5 cmake-2.8.4] [[email protected] rhel5 cmake-2.8.4]
(2) Create a MySQL installation directory and database storage directory
[[email protected] rhel5~] [[email protected] rhel5~]
(3) Create MySQL users and user groups
[[email protected] rhel5~]groupadd Mysql[[email protected] rhel5~]useradd-r-g MySQL MySQL
(4) Installing MySQL
650) this.width=650; "src="%5c "alt=" \ "copy code \" "/>
[[email protected] rhel5 Local] [[email protected] rhel5 Local] [Email protected] rhel5 mysql-5.5.10]-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.10][[email protected] Rhel5 MYSQL-5.5.10]
650) this.width=650; "src="%5c "alt=" \ "copy code \" "/>
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 Clean
# rm-f CMakeCache.txt
# RM-RF/ETC/MY.CNF
2. Configuration
(1) Set directory permissions
[[email protected] rhel5~] [[email protected] rhel5 MySQL] [[email protected] rhel5 MySQL]
(2)
[[email protected] RHEL5 mysql]# CP support-files/my-medium.cnf/etc/my.cnf//Add MySQL startup service to system service
(3) Create a table for the system database
[[email protected] rhel5 MySQL] [[email protected] rhel5 MySQL]
(4) Setting environment variables
650) this.width=650; "src="%5c "alt=" \ "copy code \" "/>
[[email protected] rhel5~] in path=:/bin add parameter: Path=:/bin:/usr/local/mysql/bin:/usr/local/mysql/lib[[email protected] Rhel5~]
650) this.width=650; "src="%5c "alt=" \ "copy code \" "/>
(5) manually start MySQL
650) this.width=650; "src="%5c "alt=" \ "copy code \" "/>
[[email protected] rhel5~] [[email protected] rhel5 MySQL] startup log is written under this file:/usr/local/mysql/data/localhost.err shutdown mysql service [[email protected] rhel5 MySQL ]
650) this.width=650; "src="%5c "alt=" \ "copy code \" "/>
(6) Another simple way to start MySQL (MySQL has been added to the system service)
[[email protected] rhel5~] [[email protected] rhel5~] [[email protected] rhel5~]
If the above command appears: Mysql.server Unrecognized service
It is possible that MySQL has not been added to the system service, which is added in another way:
[[email protected] RHEL5 mysql]# CP support-files/mysql.server/etc/init.d/mysql//Add MySQL startup service to system service
Note: The main is to copy 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/ The Support-files/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
650) this.width=650; "src="%5c "alt=" \ "copy code \" "/>
[[email protected] rhel5~]mysql>use Mysql;mysql>desc user;mysql> GRANT all privileges on * * to [email protected] identified by; The ability to add remote connections for root. Mysql>update user Set Password = Password (' xxxxxx ') where user= ' root '; mysql>select host,user,password from User whe Re user= ' root '; Mysql>flush Privileges;mysql>exit re-login: Mysql-u root-p If you are not able to connect remotely, turn off the firewall [[email protected] rhel5~]
650) this.width=650; "src="%5c "alt=" \ "copy code \" "/>
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;
This article is from the "JSON in PHP usage" blog, so be sure to keep this source http://zhaozhangxiao.blog.51cto.com/10609825/1880826
Install MySQL under Linux installation source