下载mysql5.6源码在linux下安装
Posted lin_sen
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了下载mysql5.6源码在linux下安装相关的知识,希望对你有一定的参考价值。
下载源码,编译安装.
安装环境 centOS 安装版本: mysql5.6 安装目录: /daan/mysql/5.6 Mysql源代码目录: /daan/tools/mysql5.6 (下载地址: http://mirrors.sohu.com/mysql/MySQL-5.6/)
Linux
环境提示符修改
echo "export PS1=‘[\[email protected] \w]\$ ‘" >> /etc/profile
source /etc/profile
修改主机名
vi /etc/sysconfig/network
hostname #name
路由
vi /etc/hosts
安装依赖包 yum install –y cmake yum install –y gcc yum install –y gcc-c++ yum install –y bison yum install –y bison-devel yum install –y ncurses yum install –y ncurses-devel yum -y install perl* (或者直接执行yum install -y gcc gcc-c++ bison bison-devel ncurses ncurses-devel cmake perl*)
添加用户 mkdir -p /daan/mysql/5.6/data groupadd mysql useradd mysql -g mysql -M -s /sbin/nologin
清理旧的安装环境.(如果没有安装过mysql,不用执行) make clean rm -rf CMakeCache.txt
编译 cd /daan/tools/mysql5.6 cmake /daan/tools/mysql5.6 -DCMAKE_INSTALL_PREFIX=/daan/mysql/5.6 make make install cd /daan/mysql/5.6 chown -R mysql:mysql /daan/mysql/5.6
vi /etc/my.cnf (删除所有内容,copy下面的配置 [mysql] default-character-set=utf8 [mysqld] datadir=/daan/mysql/5.6/data socket=/var/lib/mysql/mysql.sock log-bin=mysql-bin server-id=57 innodb_flush_log_at_trx_commit=1 sync_binlog=1 pid_file=/var/lib/mysql/mysql.pid init_connect=‘SET collation_connection = utf8_general_ci‘ init_connect=‘SET NAMES utf8‘ character-set-server=utf8 collation-server=utf8_general_ci skip-character-set-client-handshake #user= port=3306 #innodb default_storage_engine=InnoDB innodb_buffer_pool_size=64M innodb_log_file_size=64M innodb_file_per_table=1 #innodb_flush_method=0_DIRECT #other key_buffer_size=64M log_error=/daan/mysql/5.6/mysql-error.log slow_query_log=/daan/mysql/5.6/mysql-slow.log tmp_table_size=64M max_heap_table_size=64M query_cache_type=0 query_cache_size=0 open_files_limit=65535 [client] socket=/var/lib/mysql/mysql.sock port=3306 default-character-set=utf8 )
安装默认库 scripts/mysql_install_db --user=mysql --basedir=/daan/mysql/5.6/ --datadir=/daan/mysql/5.6/data/ mkdir /daan/mysql/5.6/init.d cp support-files/mysql.server /daan/mysql/5.6/init.d/mysql chown -R root /daan/mysql/5.6 chown -R mysql data
启动mysql init.d/mysql start ln -s /daan/mysql/5.6/bin/mysql /usr/local/bin/mysql
开mysql端口 firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd --reload
登陆,分配远程呢访问权限 mysql –uroot GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘root‘ WITH GRANT OPTION; FLUSH privileges; mysql --host=$ip -uroot -p
系统服务 cp /daan/mysql/5.6/init.d/mysql /etc/init.d/mysql chkconfig --add mysql chkconfig mysql off service mysql stop service mysql start
以上是关于下载mysql5.6源码在linux下安装的主要内容,如果未能解决你的问题,请参考以下文章
Ubuntu15.04下源码安装MySQL5.6.26数据库