[root@mysql_5 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
[root@mysql_5 ~]# uname -r
2.6.32-642.el6.x86_64
[root@mysql_5 ~]# uname -m
x86_64
[root@mysql_5 ~]# ls /software/
cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
本次安装采用cmake编译安装。
[root@mysql_5 ~]# rpm -qa|grep mysql
mysql-libs-5.1.73-7.el6.x86_64
[root@mysql_5 ~]# rpm -e mysql-libs-5.1.73-7.el6.x86_64 --nodeps
[root@mysql_5 ~]# rpm -qa|grep mysql
[root@mysql_5 ~]#
[root@mysql_5 ~]# mount /dev/cdrom /mnt/cdrom
[root@mysql_5 ~]# yum install gcc* -y
[root@mysql_5 ~]# cd /software/
[root@mysql_5 software]# ls
cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
[root@mysql_5 software]# tar xf cmake-2.8.8.tar.gz
[root@mysql_5 software]# cd cmake-2.8.8
[root@mysql_5 cmake-2.8.8]# ./configure
[root@mysql_5 cmake-2.8.8]# gmake
[root@mysql_5 cmake-2.8.8]# echo $?
0
[root@mysql_5 cmake-2.8.8]# gmake install
[root@mysql_5 software]# rpm -qa|grep ncurses
ncurses-base-5.7-4.20090207.el6.x86_64
ncurses-libs-5.7-4.20090207.el6.x86_64
ncurses-5.7-4.20090207.el6.x86_64
[root@mysql_5 software]# yum list|grep ncurses-devel
ncurses-devel.i686 5.7-4.20090207.el6 rhel-source
ncurses-devel.x86_64 5.7-4.20090207.el6 rhel-source
[root@mysql_5 software]# yum install ncurses-devel -y
[root@mysql_5 mysql-5.5.32]# useradd mysql -s /sbin/nologin -M
[root@mysql_5 mysql-5.5.32]# id mysql
uid=500(mysql) gid=500(mysql) groups=500(mysql)
[root@mysql_5 software]# mkdir /application
[root@mysql_5 software]# tar zxf mysql-5.5.32.tar.gz
[root@mysql_5 software]# cd mysql-5.5.32
[root@mysql_5 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
[root@mysql_5 mysql-5.5.32]#make && make install
[root@mysql_5 software]# cd /application/
[root@mysql_5 application]# ls
mysql-5.5.32
[root@mysql_5 application]# ln -s mysql-5.5.32/ mysql
[root@mysql_5 application]# ll
total 4
lrwxrwxrwx. 1 root root 13 Sep 18 06:52 mysql -> mysql-5.5.32/
drwxr-xr-x. 13 root root 4096 Sep 18 06:51 mysql-5.5.32
[root@mysql_5 application]# cp /software/mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf
[root@mysql_5 application]# chown -R mysql.mysql /application/mysql/data
[root@mysql_5 application]# ls -ld /application/mysql/data/
drwxr-xr-x. 3 mysql mysql 4096 Sep 18 06:50 /application/mysql/data/
[root@mysql_5 application]# cd /application/mysql/scripts/
[root@mysql_5 scripts]# ls
mysql_install_db
[root@mysql_5 scripts]# ./mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysq
[root@mysql_5 scripts]# cp /software/mysql-5.5.32/support-files/mysql.server /etc/init.d/mysqld
[root@mysql_5 scripts]# chmod +x /etc/init.d/mysqld
[root@mysql_5 scripts]# /etc/init.d/mysqld start
Starting MySQL... [ OK ]
[root@mysql_5 ~]# echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
[root@mysql_5 ~]# tail -1 /etc/profile
export PATH=/application/mysql/bin:$PATH
[root@mysql_5 ~]# source /etc/profile
[root@mysql_5 ~]# which mysql
/application/mysql/bin/mysql
[root@mysql_5 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.32 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user,host from mysql.user;
+------+---------------+
| user | host |
+------+---------------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| | mysql\_5.5.32 |
| root | mysql\_5.5.32 |
+------+---------------+
6 rows in set (0.00 sec)
mysql> drop user ''@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ''@'mysql\_5.5.32';
Query OK, 0 rows affected (0.00 sec)
mysql> drop user 'root'@'::1';
Query OK, 0 rows affected (0.00 sec)
mysql> drop user 'root'@'mysql\_5.5.32';
Query OK, 0 rows 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)
[root@mysql_5 ~]# /application/mysql/bin/mysqladmin -u root password 'system123...'
[root@mysql_5 ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@mysql_5 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.32 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>