您的位置:首页 > 数据库 > MySQL

linix下的mysql源码安装

2015-06-03 16:51 471 查看
yum remove mysql

cd /usr/local/src

wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
tar xzvf cmake-2.8.4.tar.gz

cd cmake-2.8.4

./bootstrap

(yum install gcc)

(yum install gcc-c++)

gmake

gmake install

groupadd mysql

useradd -g mysql mysql

cd /usr/local/src

wget dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.28.tar.gz

cd mysql-5.6.28.tar.gz

cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_TCP_PORT=3306 \
-DENABLE_DOWNLOADS=0

make && make install

cd /usr/local/mysql/

chown -R mysql .

chgrp -R mysql .

scripts/mysql_install_db --user=mysql

vi /etc/profile

修改
PATH=/usr/local/mysql/bin:$PATH
export PATH

source /etc/profile

cp support-files/my-default.cnf /etc/my.cnf

vi /etc/my.cnf

修改

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
pid-file=/var/lib/mysql/mysql.pid
log-error=/var/log/mysql/mysql.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd 
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

mkdir -p /var/log/mysql/
mkdir -p /var/run/mysql/

cp support-files/mysql.server /etc/init.d/mysql

chmod +x /etc/init.d/mysql

chkconfig mysql on

service mysql start

mysqladmin -u root password

(mysqld_safe --user=mysql&)

mysql -u root -p
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql