你的位置:首页 > 数据库

[数据库]VMware10.0.4下 CentOS 6.5 cmake安装 MySQL 5.5.32

一、准备工作

1.1、创建 zhuzz/tools目录

[[email protected] ~]# mkdir -p /home/zhuzz/tools[[email protected] ~]# cd /home/zhuzz/tools

 

1.2、将cmake-2.8.8.tar.gz|mysql-5.5.32.tar 上传至 zhuzz/tools目录

[[email protected] tools]# rz -y

 

1.3、解压cmake安装包
[[email protected] tools]# tar xf cmake-2.8.8.tar.gz

 
1.4、安装cmake安装包
[[email protected] tools]# cd cmake-2.8.8[[email protected] cmake-2.8.8]# ./configure
##### 报错 #####
---------------------------------------------CMake 2.8.8, Copyright 2000-2011 Kitware, Inc.---------------------------------------------Error when bootstrapping CMake:Cannot find appropriate C compiler on this system.Please specify one using environment variable CC.See cmake_bootstrap.log for compilers attempted. ---------------------------------------------Log of errors: /home/zhuzz/tools/cmake-2.8.8/Bootstrap.cmk/cmake_bootstrap.log---------------------------------------------
##### 解决方法 下载安装gcc-c++ #####
[[email protected] cmake-2.8.8]# yum install gcc-c++

 

[[email protected] cmake-2.8.8]# gmake [[email protected] cmake-2.8.8]# gmake install

 

1.5、安装依赖包 ncurses-devel
[[email protected] cmake-2.8.8]# yum install ncurses-devel -y
 
 
二、安装
2.1、创建用户和组
[[email protected] cmake-2.8.8]# groupadd mysql[[email protected] cmake-2.8.8]# useradd mysql -s /sbin/nologin -M -g mysql

 


2.2、解压 mysql-5.5.32.tar.gz 并 进入此目录
[[email protected] cmake-2.8.8]# cd ..[[email protected] tools]# tar xf mysql-5.5.32.tar.gz[[email protected] tools]# cd mysql-5.5.32

 

2.3、解压编译MySQL安装包
[[email protected] tools]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.32 \-DMYSQL_DATADIR=/usr/local/mysql-5.5.32/data \-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.32/tmp/mysql.sock \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_FEDERATED_STORAGE_ENGINE=1 \-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLED_LOCAL_INFILE=1 \-DWITH_DEBUG=0 \

 

[[email protected] mysql-5.5.32]# make && make install

 

2.4、创建软链接
[[email protected] mysql-5.5.32]# ln -s /usr/local/mysql-5.5.32/ /usr/local/mysql

 

2.5、配置文件
[[email protected] mysql-5.5.32]# cp support-files/my-small.cnf /etc/my.cnf 

 

 
2.6、配置环境变量
[[email protected] mysql-5.5.32]# echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile[[email protected] mysql-5.5.32]# tail -l /etc/profile[[email protected] mysql-5.5.32]# source /etc/profile[[email protected] mysql-5.5.32]# echo $PATH/usr/local/mysql/bin:/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

 

2.7、授权
[[email protected] mysql-5.5.32]# cd /usr/local/mysql[[email protected] mysql]# chown -R mysql.mysql ./[[email protected] mysql]# chmod -R 1777 /tmp/

 

三、初始化、启动

3.1、进入安装目录的mysql/scripts目录并初始化

[[email protected] mysql]# cd /usr/local/mysql/scripts/
[[email protected] scripts]# ./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql

 


##### 看见一下则初始化OK #####
Installing MySQL system tables...OKFilling help tables...OK

 


3.2配置文件
[[email protected] scripts]# cd /home/zhuzz/tools/mysql-5.5.32[[email protected] mysql-5.5.32]# cp support-files/mysql.server /etc/init.d/mysqld

 

3.3、给mysql启动目录授权

[[email protected] mysql-5.5.32]# chmod +x /etc/init.d/mysqld

 

3.4、启动MySQL

[[email protected] mysql-5.5.32]# /etc/init.d/mysqld start[[email protected] mysql-5.5.32]# mysqlmysql> quit

 

3.5、修改密码bin验证是否安装成功

[[email protected] mysql-5.5.32]# /usr/local/mysql//bin/mysqladmin -u root password 'root'[[email protected] mysql-5.5.32]# chkconfig mysqld on[[email protected] mysql-5.5.32]# chkconfig --list mysqld mysqld     0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭

 

四、备注:

4.1、添加额外的管理员
mysql>delete from mysql.user;mysql>grant all privileges on *.* to system@'localhost' identified by 'system' with grant option;

 

4.2、初始化成功显示如下

Installing MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/local/mysql//bin/mysqladmin -u root password 'new-password'/usr/local/mysql//bin/mysqladmin -u root -h localhost.localdomain password 'new-password'Alternatively you can run:/usr/local/mysql//bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. 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 with mysql-test-run.plcd /usr/local/mysql//mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/local/mysql//scripts/mysqlbug script!