CENTOS 6.5 平台离线编译安装 Mysql5.6.22
一、下载源码包
http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.22.tar.gz
二、准备工作
卸载之前本机自带的MYSQL
安装 cmake,编译MYSQL 的工具
yum install cmake
三、解压源码包
tar -zxv -f mysql-5.6..tar.gz<br/> cd mysql-5.6.
四、CMake编译
cmake \<br/> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \<br/> -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \<br/> -DDEFAULT_CHARSET=utf8 \<br/> -DDEFAULT_COLLATION=utf8_general_ci \<br/> -DWITH_INNOBASE_STORAGE_ENGINE= \<br/> -DWITH_ARCHIVE_STORAGE_ENGINE= \<br/> -DWITH_BLACKHOLE_STORAGE_ENGINE= \<br/> -DMYSQL_DATADIR=/jbdata/mysqldb \<br/> -DMYSQL_TCP_PORT= \<br/> -DENABLE_DOWNLOADS= 注:重新运行配置,需要删除CMakeCache.txt文件 执行make<br/>make 安装<br/>make install
五、初始化 mysql 数据库
cd /usr/local/mysql<br/> scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
六、复制启动文件
To start mysqld at boot time you have to copy<br/> support-files/mysql.server to the right place for your system cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
七、复制服务启动脚本及加入PATH路径
cp support-files/mysql.server /etc/init.d/mysqld
修改PATH环境变量,让系统可以直接使用mysql的相关命令。
#vim /etc/profile.d/mysql.sh
export PATH=$PATH:/usr/local/mysql/bin
————————————————————————————-
vim /etc/profile PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH export PATH source /etc/profile
八、启动mysql并加入开机启动
service mysqld start<br/> chkconfig --level mysqld on
九、检查mysql是否启动
netstat -tulnp | grep<br/> mysql -u root -p
十、设置mysql密码
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !<br/> To do so, start the server, then issue the following commands: ./bin/mysqladmin -u root password 'new-password'<br/> ./bin/mysqladmin -u root -h localhost.localdomain password 'new-password' Alternatively you can run: ./bin/mysql_secure_installation
转发申明:
本文转自互联网,由小站整理并发布,在于分享相关技术和知识。版权归原作者所有,如有侵权,请联系本站 top8488@163.com,将在24小时内删除。谢谢