cmake 的解压
cd cmake-2.8.8
./configure
gmake(注意这里是gmake)
gmake install
安装好之后,还需要安装一些依赖
yum install ncurses-devel -y
tar xf mysql-5.5.32.tar.gz
cd mysql-5.5.32
groupadd mysql
useradd mysql -s /sbin/nologin -M -g mysql
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
make && make install
ln -s /application/mysql-5.5.32/ /application/mysql
以上代表安装成功,
下面的是初使化
cp mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf
会显示是否覆盖,选择是
这里选择的文件是my-small.cnf,因是测试环境,生产环境可以根据硬件选择,例如:my-innodb-heavy-4G.cnf
然后配置环境变量,建议最好配
echo 'export PATH=/application/mysql/bin:$PATH' >> /etc/profile
tail -1 /etc/profile
source /etc/profile
echo $PATH
下面是初始化数据文件
chown -R mysql.mysql /application/mysql/data
chmod -R 1777/tmp/
cd /application/mysql/scripts/
./mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
然后看是否有两个OK
然后再设置一下启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
加个权限
chmod +x /etc/init.d/mysqld
然后启动mysql
/etc/init.d/mysqld start
*****登录mysql 故障解决
mysql
ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password :NO)
问题解决:
#pkill mysqld
#lsof -i :3306
#rm -rf /application/mysql/data/*
#/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
解决!
登录成功后,查看哪些空登录。
select user,host from mysql.user;
删除那些空登录的。
delete from mysql.user where user='';
删除那些ipv6的
delete from mysql.user where host = '::1';
删除test库
drop database test;
show databases;
quit
退出,为mysql 增加密码。
/application/mysql//bin/mysqladmin -u root password 'liucong008'
设置开机启动
chkconfig mysqld on
chkconfig mysqld --list