1. Install the MySQL in yum mode
Yum installation of MySQL is extremely straightforward, as long as you execute the Yum install Mysql-server.
-
- yum/rpm Way to install MySQL application scenario
YUM/RPM installation is suitable for applications where database requirements are not very high, such as small concurrency, intra-company, intra-enterprise scenarios.
2. Binary installation MySQL
Decompression can be used (green software, no installation) simple, fast, not good customization.
Binary package: mysql-5.5.32-linux2.6-x86_64.tar.gz
-
- Install mysql step:
A, add MySQL user
Useradd mysql-s/sbin/nologin-m
B, download unzip software
[[email protected] ~ ]# cd/home/oldboy/tools/
[[email protected] tools]# tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz
[[Email protected] tools]# mv mysql-5.5.32-linux2.6-x86_64/application/mysql-5.5.32 #移到/application
[[email protected] tools]# ln-s/application/mysql-5.5.32//application/mysql
C, initializing the database
[[email protected] tools]#/application/mysql/scripts/mysql_install_db--basedir=/application/mysql/--datadir=/ application/mysql/data/--user=mysql
D, authorized MySQL Management database file
Chown-r mysql.mysql/application/mysql/
E, Generate MySQL configuration file
[[email protected] mysql]# cp/application/mysql/support-files/my-small.cnf/etc/my.cnf
-
- Configure start MySQL
[Email protected] mysql]# sed-i ' s#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe# 改变mysql目录
[Email protected] mysql]#/application/mysql/bin/mysqld_safe &#启动mysql服务
-
- Configure the traditional way to start MySQL
A, [[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld#将mysql的配置文件复制到/etc/init.d目录下。
b, [[email protected] mysql]# sed-i ' s#/usr/local/mysql#/application/mysql#g '/etc/init.d/mysqld#改变mysql的目录。
c, [[email protected] mysql]# chmod +x/etc/init.d/mysqld#增加执行权限
D, [[email protected] mysql]#/etc/init.d/mysqld start
e, [[email protected] mysql]# chkconfig mysqld on#加入开机自启动
F, cp/application/mysql/bin/*/usr/local/sbin/#将mysql启动命令拷贝到bash里。
3. Install MySQL with cmake compilation
The./cmake;make;make install, the specific commands and parameters for the production scenario are:
1.3 Installing the related packages
1.3.1 CMake Software
cd/home/oldboy/tools/
Tar XF cmake-2.8.8.tar.gz
CD cmake-2.8.8
./configure
#CMake has bootstrapped. Now run Gmake.
Gmake
Gmake Install
Cd.. /
1.3.2 Dependency Packages
Yum Install Ncurses-devel-y
1.4 Starting MySQL Installation
1.4.1 Creating users and Groups
Groupadd MySQL
Useradd mysql-s/sbin/nologin-m-G MySQL
1.4.2 Unzip the compiled MySQL
tar zxf mysql-5.5.32.tar.gz
CD mysql-5.5.32
CMake.-dcmake_install_prefix=/application/ mysql-5.5.32 \
-dmysql_datadir=/application/mysql-5.5.32/data \
-dmysql_unix_addr=/application/ Mysql-5.5.32/tmp/mysql.sock \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci \
-DEXTRA_ CHARSETS=GBK,GB2312,UTF8,ASCII \
-denabled_local_infile=on \
-dwith_innobase_storage_engine=1 \
-DWITH_ federated_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwithout_example_storage_engine=1 \
- dwithout_partition_storage_engine=1 \
-dwith_fast_mutexes=1 \
-dwith_zlib=bundled \
-DENABLED_LOCAL_ infile=1 \
-dwith_readline=1 \
-dwith_embedded_server=1 \
-dwith_debug=0
#--Build files has been written to:/home/oldboy/tools/mysql-5.5.32
Tip, there are many options to configure at compile time, refer to the end of the appendix or official documentation:
Make
#[100%] Built Target my_safe_process
Make install
Ln-s/application/mysql-5.5.32//application/mysql
If there is no error in the above operation, the installation of the MYSQL5.5.32 software CMake mode is successful.
MySQL Multiple installation methods