Prepare the Environment
Install MySQL Dependency package
Yum Install-y ncurses-devel
[Email protected] ~]# CD tools/
[[email protected] tools]# ls
Cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
Installing CMake
[Email protected] tools]# TAR-XF cmake-2.8.8.tar.gz
[Email protected] tools]# CD cmake-2.8.8/
[Email protected] cmake-2.8.8]#./configure
......
--Configuring done
--Generating done
--Build files has been written to:/root/tools/cmake-2.8.8
---------------------------------------------
CMake has bootstrapped. Now run Gmake.
[Email protected] cmake-2.8.8]# Gmake
[[email protected] cmake-2.8.8]# gmake Install
[Email protected] ~]# CD tools/
[Email protected] tools]# TAR-XF mysql-5.5.32.tar.gz
[Email protected] tools]# CD mysql-5.5.32/
[email protected] mysql-5.5.32]# cat install-mysql5.5.32.sh
CMake. -dcmake_install_prefix=/usr/local/mysql \
-dmysql_datadir=/usr/local/mysql/data \
-dmysql_unix_addr=/usr/local/mysql/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
[Email protected] mysql-5.5.32]# bash install-mysql5.5.32.sh
[[email protected] mysql-5.5.32]# make-j 4 && make install
Initialize configuration
[[email protected] ~]# useradd-m-s/sbin/nologin MySQL
[Email protected] ~]# CD tools/mysql-5.5.32/
[email protected] mysql-5.5.32]# CP support-files/my-medium.cnf/etc/my.cnf
CP: Do you want to overwrite "/etc/my.cnf"? Y
Adding a startup script to the system
[email protected] mysql-5.5.32]# CP support-files/mysql.server/etc/rc.d/init.d/mysqld
[Email protected] mysql-5.5.32]# chmod 750/etc/rc.d/init.d/mysqld
Environment variable Configuration
[Email protected] ~]# Source/etc/profile
[Email protected] ~]# tail-n 1/etc/profile
path=/usr/local/mysql/bin/: $PATH
Initializing the database
[Email protected] ~]# chown-r mysql.mysql/usr/local/mysql
[Email protected] ~]# cd/usr/local/mysql/scripts/
[Email protected] scripts]#/mysql_install_db \
\>--basedir=/usr/local/mysql \
\>--datadir=/usr/local/mysql/data \
\>--user=mysql
Installing MySQL system tables ...
Ok
Filling Help Tables ...
Ok
Start the service
[[Email protected] ~]# service mysqld start
Starting MySQL ... success!
[Email protected] ~]# NETSTAT-ANUTP | grep mysqld
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 28170/mysqld
Set the password (use your own security script here)
[Email protected] ~]# mysql_secure_installation
......
Set root Password? [y/n]
New password:1
Re-enter New Password:1
Password Updated successfully!
......
View Authorization Form
[Email protected] ~]# MYSQL-UROOT-P1
Mysql> select User,host from Mysql.user;
+------+-----------+
| user | Host |
+------+-----------+
| Root | 127.0.0.1 |
| Root | :: 1 |
| Root | localhost |
+------+-----------+
3 rows in Set (0.01 sec)
Delete Extra authorization data items
Mysql> Delete from Mysql.user where host= ':: 1 ';
Query OK, 1 row Affected (0.00 sec)
Mysql> select User,host from Mysql.user;
+------+-----------+
| user | Host |
+------+-----------+
| Root | 127.0.0.1 |
| Root | localhost |
+------+-----------+
2 rows in Set (0.00 sec)
Feel this article good can share to your friends or subscribe me, later will share more Linux technical Articles
Proficient in RHEL7 compilation and installation mysql-5.5.32