(1)、解决perl编译问题
1
2
|
echo 'export LC_ALL=C' >> /etc/profile source /etc/profile |
(2)、安装CAMKE
1
2
3
4
5
6
|
cd /home/xu/tools wget http: //www .cmake.org /files/v2 .8 /cmake-2 .8.4. tar .gz tar zxf cmake-2.8.4. tar .gz cd cmake-2.8.4 . /configure make & make install |
(3)、创建用户
1
2
|
groupadd mysql useradd -g mysql mysql |
(4)、编译安装mysql
1
2
3
4
5
6
7
8
9
10
11
12
|
wget http: //mysql .ntu.edu.tw /Downloads/MySQL-5 .5 /mysql-5 .5.27. tar .gz tar zxf mysql-5.5.27. tar .gz cd mysql-5.5.27 cmake -DCMAKE_INSTALL_PREFIX= /usr/local/mysql \ -DMYSQL_UNIX_ADDR= /tmp/mysql .sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=complex \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 make -j 4 make install |
(5)、设置mysql环境变量
1
2
|
[root@master1 ~] # echo 'PATH=$PATH:/usr/local/mysql/bin' >>/etc/profile [root@master1 ~] # source /etc/profile |
(6)、初始化数据库
1
2
3
4
|
[root@master1 ~] # mount /dev/drbd1 /data 说明:数据库存放数据的目录是drbd分区 [root@master1 ~] # cd /usr/local/mysql/ [root@master1 ~] # ./scripts/mysql_install_db --datadir=/data/ --user=mysql |
(7)、启动数据库
1
2
3
4
5
|
[root@master1 ~] # vim /etc/init.d/mysqld datadir= /data 说明:修改mysql启动脚本,指定数据库的目录为 /data [root@master1 ~] # /etc/init.d/mysqld start [root@master1 ~] # chkconfig mysqld off |
(8)、测试数据库
1
2
3
4
5
6
7
8
|
[root@master1 ~] # mysql -uroot -e "show databases;" +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ |
更多内容请进
转载自老男孩http://oldboy.blog.51cto.com/2561410/1240412
本文来自博客园,作者:孙龙-程序员,转载请注明原文链接:https://www.cnblogs.com/sunlong88/articles/8681712.html