linux内核版本:
#uname -r
2.6.32-220.7.1.el6.centos.plus.x86_64
需要的软件:
cmake-2.8.5.tar.gz
mysql-5.5.22.tar.gz
因为mysql5.5是通过cmake编译器进行编译所以安装mysql5.5时先安装cmake
#yum -y install ncurses-devel *gcc* *make*
安装cmake:
wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
#tar -zxvf cmake-2.8.5.tar.gz
#cd cmake-2.8.5
#./bootstrap
#make && make install
安装mysql:
到官方网站下载mysql最新版本:
http://dev.mysql.com/downloads/
我这下载的是目前最新的
#tar -zxvf mysql-5.5.22.tar.gz
#cd mysql-5.5.22
// 详细参数请参考:http://blog.wqgcool.com/?p=677
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5\
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql5 \
-DEXTRA_CHARSETS=all
#make && make install
//如果要重新牌子请执行:
#rm -rf CMakeCache.txt
#make clean all
配置mysql5:
# pwd
/usr/local/mysql5
#cp support-files/my-medium.cnf /etc/my.cnf
//创建mysql配置文件
//开机启动
#cp support-files/mysql.server /etc/init.d/mysql
#
chkconfig --add mysql
初始化数据库:
#
chown -R mysql
/usr/local/mysql5/
#chown -R mysql:mysql
/usr/local/mysql5/data
#
/usr/local/mysql5/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql5 --datadir=/usr/local/mysql5/data
//操作这一步可能会报错,所以在编译的时候最好少添加点参数。如过和我一样是菜鸟的话!
#
service mysql start
# chkconfig mysql on
#ps -e | grep mysql
5722 pts/0 00:00:00 mysqld_safe
5974 pts/0 00:00:00 mysqld
设置mysql的PATH路径
#export PATH=$PATH:/usr/local/mysql5/bin/
#echo "PATH=$PATH:/usr/local/mysql5/bin/" >> /etc/profile
//永久生肖
登录mysql
#mysqladmin -u root password wdmysql
输入密码:
mysql> status;
--------------
mysql Ver 14.14 Distrib 5.5.22, for Linux (x86_64) using EditLine wrapper //查看mysql版本
Connection id: 8
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.22-log Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 30 min 9 sec
Threads: 2 Questions: 28 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.015
--------------
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
这就说明mysql安装成功了~