redhat 6.5 【源码编译安装 mysql-5.5.47】

操作系统:Redhat Enterprise Linux 6.5

一. 创建用户、目录和修改权限

[root@xuegod64 ~]#mkdir -p /usr/local/mysql/data

[root@xuegod64 ~]#groupadd mysql

[root@xuegod64 ~]#useradd -g mysql mysql

[root@xuegod64 ~]#chown -R mysql.mysql /usr/local/mysql/data/ 

 

二. 安装所需相关库文件

[root@xuegod64 ~]#yum install -y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* cmake

 

三、解压mysql-mysql-5.5.47

[root@xuegod64 ~]#tar -zxvf mysql-5.5.47.tar.gz

 

四、编译安装

[root@xuegod64 ~]#cd mysql-5.5.47

[root@xuegod64 mysql-5.5.47]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql

[root@xuegod64 mysql-5.5.47]# make && make install

[root@xuegod64 mysql-5.5.47]# cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf

 

五、初始化数据库

[root@xuegod64 mysql-5.5.47]#cd /usr/local/mysql/

[root@xuegod64 mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/

 

六、设置启动脚本位置及开机启动

 

[root@xuegod64 mysql]#cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@xuegod64 mysql]#chkconfig mysqld on

  

七、添加环境变量

[root@xuegod64 mysql]# echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile
[root@xuegod64 mysql]# source /etc/profile

 

八、启动mysql服务

[root@xuegod64 ]# /etc/init.d/mysql start

 

九、安装完成修改mysql密码和远程访问

[root@xuegod64 ]# mysql -u root -p
Enter password:       默认无密码,直接回车
mysql>use mysql;
mysql> update user set password=password("123456");  //修改密码
mysql> update user set `host` = '%' where `user` = 'root' limit 1;   //修改可远程访问
mysql > exit  //退出

 

十、重启Mysql

[root@xuegod64 ]# /etc/init.d/mysqld restart

 

posted @ 2015-12-10 16:44  小懒的博客  阅读(838)  评论(0编辑  收藏  举报