linux下mysql-5.6.23.tar.gz安装与配置

1.卸载系统默认的mysql
[root@localhost ~]# rpm -qa | grep mysql 
mysql-libs-5.1.66-2.el6_3.x86_64
mysql-devel-5.1.66-2.el6_3.x86_64
mysql-5.1.66-2.el6_3.x86_64
[root@localhost ~]# rpm -e mysql-libs-5.1.66-2.el6_3.x86_64
error: Failed dependencies:
        libmysqlclient.so.16()(64bit) is needed by (installed) mysql-5.1.66-2.el6_3.x86_64
        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
        libmysqlclient.so.16()(64bit) is needed by (installed) mysql-devel-5.1.66-2.el6_3.x86_64
        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.66-2.el6_3.x86_64
        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
        libmysqlclient_r.so.16()(64bit) is needed by (installed) mysql-5.1.66-2.el6_3.x86_64
        libmysqlclient_r.so.16()(64bit) is needed by (installed) mysql-devel-5.1.66-2.el6_3.x86_64
        libmysqlclient_r.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.66-2.el6_3.x86_64
        mysql-libs = 5.1.66-2.el6_3 is needed by (installed) mysql-5.1.66-2.el6_3.x86_64
        mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
[root@localhost ~]# rpm -e mysql-devel-5.1.66-2.el6_3.x86_64
[root@localhost ~]# rpm -e mysql-5.1.66-2.el6_3.x86_64
[root@localhost ~]# rpm -e mysql-libs-5.1.66-2.el6_3.x86_64
error: Failed dependencies:
        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
        mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
[root@localhost ~]# rpm -qa | grep mysql 
mysql-libs-5.1.66-2.el6_3.x86_64
[root@localhost ~]# 




2.创建用户
以root用户登陆,创建mysql用户,用来维护mysql服务
[root@localhost ~]# 
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -g mysql mysql
[root@localhost ~]# passwd mysql

更改用户 mysql 的密码 。
新的 密码:
无效的密码: 过短
无效的密码: 过于简单
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。
[
root@localhost ~]# 

[root@localhost mysql]# ll
总用量 38160
-rw-r--r--. 1 root root  5959549 3月   6 14:47 cmake-3.1.3.tar.gz
-rw-r--r--. 1 root root 33115859 3月   6 14:48 mysql-5.6.23.tar.gz
[root@localhost mysql]# 
[root@localhost mysql]# which cmake
/usr/bin/which: no cmake in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.7.0_75/bin:/usr/java/jdk1.7.0_75/jre/bin:/root/bin)
[root@localhost mysql]# 

[root@localhost mysql]# tar zxvf cmake-3.1.3.tar.gz  
[root@localhost mysql]# cd cmake-3.1.3  
[root@localhost mysql]# ./configure  
[root@localhost mysql]# make  
[root@localhost mysql]# make install  



3.安装mysql 软件
准备好安装介质(mysql-5.6.23.tar.gz)

[root@localhost mysql]# tar zxvf mysql-5.6.23.tar.gz  



4.安装mysql软件
[root@localhost mysql]# cd mysql-5.6.23
[root@localhost mysql-5.6.23]# cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql56 -DSYSCONFDIR=/opt/mysql56/data -DMYSQL_DATADIR=/opt/mysql56/data -DMYSQL_UNIX_ADDR=/opt/mysql56/data/mysqld.sock -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1  -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1  -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=3306 -DWITH_EXTRA_CHARSETS=all -DWITH_DEBUG=0 -DENABLE_DEBUG_SYNC=0 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_READLINE=1 -DZLIB_INCLUDE_DIR=/usr -DWITH_READLINE=1  

[root@localhost mysql-5.6.23]# make  
[root@localhost mysql-5.6.23]# make install 


5.运行mysql_install_db生成授权表
[root@localhost mysql-5.6.23]# cd /opt/
[root@localhost opt]# chown -R mysql:mysql mysql56

[root@localhost opt]# su – mysql  
[mysql@localhost ~]$ cd /opt/mysql56  
[mysql@localhost mysql56]$ cp scripts/mysql_install_db .  
[mysql@localhost mysql56]$ ./mysql_install_db  



7.配置自动服务
配置mysql服务
切换到root用户
[root@localhost mysql56]# cp  -r support-files/mysql.server /etc/init.d/mysql  
[root@localhost mysql56]# cd /etc/rc.d/init.d  
[root@localhost init.d]# chmod +x mysql  
[root@localhost init.d]# /sbin/chkconfig --del mysql  
[root@localhost init.d]# /sbin/chkconfig  --add mysql  
[root@localhost init.d]# service mysql start  




你可能感兴趣的:(mysql,linux,unix)