MYSQL5.7.20捣鼓了半夜,还是编译不通过,好像是BOOST的问题,换成5.6了,马上就编译成功了
yum -y
install
make
gcc
-c++ cmake bison-devel ncurses-devel
gcc
\
autoconf automake zlib* fiex* libxml* libmcrypt* libtool-ltdl-devel*
wget http:
//dev
.mysql.com
/get/Downloads/MySQL-5
.6
/mysql-5
.6.16.
tar
.gz
tar
xvf mysql-5.6.16.
tar
.gz
cd
mysql-5.6.16
cmake \
-DCMAKE_INSTALL_PREFIX=
/usr/local/mysql
\
-DMYSQL_DATADIR=
/data/mysql/data
\
-DSYSCONFDIR=
/etc
\
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=
/tmp/mysql/mysql
.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
CMAKE出错了,记得删除CMAKE生成的RM CMAKE什么文件来着,,
make
&&
make
install
groupadd mysql
useradd
-r -g mysql mysql
cd
/usr/local/mysql
chown
-R mysql:mysql .
scripts
/mysql_install_db
--user=mysql --ldata=
/data/mysql/data
chown
-R root .
chown
-R mysql data
说明:参数--ldata
说明你的数据文件存放的目录,如果你使用默认的路径,那么这个参数可以去除。如果你不增加此参数,但是在配置文件(见下方的datadir配置)中指定了其他的目录,那么会在启动MySQL的时候出现类似的提示:
/etc/my.cnf
[client]
port=3306
socket=
/var/lib/mysql/mysql
.sock
default-character-
set
= utf8
[mysqld]
port=3306
bind-address=127.0.0.1
basedir=
/usr/local/mysql
datadir=
/data/data/mysql/data
socket=
/var/lib/mysql/mysql
.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
############# default settings ################
# time zone
default-
time
-zone = system
character-
set
-server = utf8
default-storage-engine = InnoDB
[mysqld_safe]
log-error=
/var/log/mysqld
.log
pid-
file
=
/var/run/mysqld/mysqld
.pid
手动启动MySQL。
1
2
3
4
|
cp
/usr/local/mysql/support-files/mysql
.server
/etc/init
.d
/mysql
/etc/init
.d
/mysql
start
##或者
service mysql start
|
在上面的步骤后,开机自动启动设置
1
2
3
|
chkconfig --add mysql
##有的系统需要下面的
chkconfig --level 345 mysql on
|
可以参考:http://dev.mysql.com/doc/refman/5.6/en/automatic-start.html
默认的密码是空的,很危险,需要修改一下。
在此之前,为方便调用mysql,我们先生成一个mysql的软链。
1
|
ln
-s
/usr/local/mysql/bin/mysql
/usr/bin/
|
然后修改密码
1
2
|
mysql -uroot -h127.0.0.1 -p
mysql> SET PASSWORD = PASSWORD(
'123456'
);
|
将来如果你忘记了root密码,可以参考重置MySQL密码。
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
http://www.chenyudong.com/archives/building-mysql-5-6-from-source.html