The Installation Method of MySQL5.5 is slightly different from that of 5.1. The main difference lies in the configuration environment. For the installation method of MySQL5.1, refer to build the LAMP environment (source code ). This article explains how to install MySQL on RedHat6.1. First of all, we need to prepare MySQL. As for where to download it, I don't need to talk about it. This is a tough smart guy. This article
The Installation Method of MySQL 5.5 is slightly different from that of MySQL 5.1. The main difference lies in the configuration environment. For the installation method of MySQL 5.1, refer to build the LAMP environment (source code method ). This article explains how to install MySQL 6.1 On the RedHat 5.5 system. First of all, we need to prepare MySQL. As for where to download it, I don't need to talk about it. This is a tough and intelligent partner. This article
The Installation Method of MySQL 5.5 is slightly different from that of MySQL 5.1. The main difference lies in the configuration environment. For the installation method of MySQL 5.1, refer to build the LAMP environment (source code method ). This article explains how to install MySQL 6.1 on RedHat 5.5.
First of all, we need to prepare MySQL. As for where to download it, we don't need to talk about it. It's hard to be a smart friend. The MySQL version used in this article is 5.5.29. If the reader has prepared the version or other versions of MySQL 5.5, the following describes how to install MySQL 5.5. All operations in this article are completed under the virtual machine.
Step 1: copy the MySQL 5.5 source code package to the Virtual Machine
[root@serv01 ~]# yum install /usr/bin/scp -y[root@larrywen ule-mysql]# scpmysql-5.5.29.tar.gz 192.168.1.11:/optroot@192.168.1.11's password:mysql-5.5.29.tar.gz 100% 24MB 23.7MB/s 00:00
Step 2: make and other commands are required to compile the source code. Therefore, we need to install the development kit.
[root@serv01 ~]# yum grouplist | grep Devel Additional Development Desktop Platform Development Development tools Server Platform Development[root@serv01 ~]# yum groupinstall"Development tools" -y
Step 3: Decompress the source code package to the/usr/src directory./usr/src is the recommended command.
[root@serv01 opt]# tar -xvf mysql-5.5.29.tar.gz -C /usr/src/
Step 4: Enter the MySQL decompression directory
[Root @ serv01 opt] # cd/usr/src/mysql-5.5.29/# installation help documentation (refer to this file for installation) [root @ serv01 mysql-5.5.29] # vim INSTALL-SOURCEshell> tar zxvf mysql-VERSION.tar.gzshell> cd mysql-VERSIONshell> cmake. shell> makeshell> make install # End of source-build specific instructions # Postinstallation setupshell> cd/usr/local/mysqlshell> chown-R mysql. shell> chgrp-R mysql. shell> scripts/mysql_install_db -- user = mysqlshell> chown-R root. shell & gt; chown-R mysql data # Next command is optionalshell & gt; cp support-files/my-medium.cnf/etc/my. cnfshell> bin/mysqld_safe -- user = mysql & # Next command is optionalshell> cp support-files/mysql. server/etc/init. d/mysql. server
Step 5: Because the configuration environment requires cmake and MySQL depends on the ncurses-devel package, we install cmake and ncurses-devel
[root@serv01 mysql-5.5.29]# yum install cmake-y[root@serv01 mysql-5.5.29]# yum install ncurses-devel -y
Step 6,Key stepsThis step is also different from MySQL 5.1. Use the cmake command to configure the environment, as shown below:
[Root @ serv01 mysql-5.5.29] # cmake. \-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \-Internal = 1 \-Internal = 1 \-Internal = 1 \-DDEFAULT_CHARSET = utf8 \-DDEFAULT_COLLATION = utf8_general_ci \-Internal = all -DMYSQL_TCP_PORT = 3306 \-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \-DMYSQL_DATADIR =/usr/local/mysql/dataExplanation:-DCMAKE_INSTALL_PREFIX =/usr/local/mysql: MySQL installation directory. We recommend that you install it in this directory-DWITH_INNOBASE_STORAGE_ENGINE = 1: Install InnoDB Storage engine-DWITH_MYISAM_STORAGE_ENGINE = 1: install MyISAM storage engine-DWITH_MEMORY_STORAGE_ENGINE = 1: install memory storage engine-DDEFAULT_CHARSET = utf8: default encoding set to utf8-DDEFAULT_COLLATION = utf8_general_ci: The Silent validation rule is utf8_general_ci-DWITH_EXTRA_CHARSETS = all: all other codes are supported-DMYSQL_TCP_PORT = 3306: MySQL port is 3306-DMYSQL_UNIX_ADDR =/tmp/mysql. sock: Specify the SOCK file path-DMYSQL_DATADIR =/usr/local/mysql/data: MySQL data DIRECTORY
Step 7: Compile and install
[Root @ serv01 mysql-5.5.29] # make & make install # make sure the installation directory exists [root @ serv01 mysql-5.5.29] # ls/usr/local/mysql/bin COPYING data docs include INSTALL-BINARY lib man mysql-test README scripts share SQL-plugin support-files
Step 8: Add a mysql group and user
[root@serv01 opt]# groupadd -g 500 mysql[root@serv01 opt]# useradd -u 500 -g 500 -r -M -s /sbin/nologin mysql
Step 9: copy the configuration file and startup script, and modify the execution permission of the startup script.
[root@serv01 mysql-5.5.29]# cpsupport-files/my-medium.cnf /etc/my.cnfcp: overwrite `/etc/my.cnf'? y[root@serv01 mysql-5.5.29]# cpsupport-files/mysql.server /etc/init.d/mysqld[root@serv01 mysql-5.5.29]# chmod a+x/etc/init.d/mysqld[root@serv01 mysql-5.5.29]# ls /usr/local/mysql/data/mysql test
Step 10: Change the owner and group of the mysql directory, modify the my. cnf file, and add the data directory.
[root@serv01 mysql-5.5.29]# chown mysql.mysql/usr/local/mysql/ -R[root@serv01 mysql-5.5.29]# vim /etc/my.cnf[root@serv01 mysql-5.5.29]# cat /etc/my.cnf |grep datadirdatadir =/usr/local/mysql/data
Step 2: modify the permissions of mysql_install_db to make it executable and perform initialization.
[root@serv01 mysql-5.5.29]# chmod a+xscripts/mysql_install_db[root@serv01 mysql-5.5.29]#./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/--basedir=/usr/local/mysql/WARNING: The host 'serv01.host.com' could notbe looked up with resolveip.This probably means that your libc librariesare not 100 % compatiblewith this binary MySQL version. The MySQLdaemon, mysqld, should worknormally with the exception that host nameresolving will not work.This means that you should use IP addressesinstead of hostnameswhen specifying MySQL privileges !Installing MySQL system tables...OKFilling help tables...OK To start mysqld at boot time you have to copysupport-files/mysql.server to the right placefor your system PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !To do so, start the server, then issue thefollowing commands: /usr/local/mysql//bin/mysqladmin -u rootpassword 'new-password'/usr/local/mysql//bin/mysqladmin -u root -hserv01.host.com password 'new-password' Alternatively you can run:/usr/local/mysql//bin/mysql_secure_installation which will also give you the option ofremoving the testdatabases and anonymous user created bydefault. This isstrongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with:cd /usr/local/mysql/ ;/usr/local/mysql//bin/mysqld_safe & You can test the MySQL daemon withmysql-test-run.plcd /usr/local/mysql//mysql-test ; perlmysql-test-run.pl Please report any problems with the/usr/local/mysql//scripts/mysqlbug script!
Step 2: Start MySQL. If SUCCESS occurs, congratulations, MySQL is started successfully. If an error occurs, do not worry. troubleshoot the error according to the log.
[root@serv01 mysql-5.5.29]#/etc/init.d/mysqld startStarting MySQL.. SUCCESS![root@serv01 mysql-5.5.29]# ll/usr/local/mysql/data/ -ddrwxr-xr-x. 5 mysql mysql 4096 Sep 4 23:39 /usr/local/mysql/data/
Step 2: Add and make the environment variables take effect.
[root@serv01 mysql-5.5.29]# vim~/.bash_profile[root@serv01 mysql-5.5.29]# . !$. ~/.bash_profile[root@serv01 mysql-5.5.29]# cat ~/.bash_profile| grep PATHPATH=/usr/local/mysql/bin/:$PATH:$HOME/binexport PATH
Step 2: log on to mysql and check the version. if the version number is displayed, the installation is successful.
[root@serv01 mysql-5.5.29]# mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.5.29-log Sourcedistribution Copyright (c) 2000, 2012, Oracle and/or itsaffiliates. All rights reserved. Oracle is a registered trademark of OracleCorporation and/or itsaffiliates. Other names may be trademarks oftheir respectiveowners. Type 'help;' or '\h' for help. Type '\c' toclear the current input statement. mysql> select version();+------------+| version() |+------------+| 5.5.29-log |+------------+1 row in set (0.00 sec) mysql> exitBye
To Install Multiple MySQL instances, modify the port and the sock file.
[root@serv01 mysql-5.5.29]# cat /etc/my.cnf |grep -e sock -e portport =3306socket =/tmp/mysql.sock
My mailbox: wgbno27@163.com Sina Weibo: @ Wentasy27 public platform: JustOracle (No.: justoracle) database technology exchange group: 336882565 (verification From csdn xxx When adding group)All is well October 20, 2013 By Larry Wen