1、准备
cmake-3.6.0.tar.gz
bison-3.0.4.tar.gz
mysql-5.7.13.tar.gz (http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz)
2、安装cmake 和 bison
首先可以查看下是否安装了cmake
1
2
3
4
5
6
7
8
9
|
# rpm -qa |grep cmake
# tar zxvf cmake-3.6.0.tar.gz
# cd cmake-3.6.0
# ./bootstrap
# make && make install
# tar zxvf bison-3.0.4.tar.gz
# cd bison-3.0.4
# ./configure
# make && make install
|
3、安装Mysql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
[root@localhost src]# tar -zxvfmysql-5.7.13.tar.gz
[root@localhost src]# cd mysql-5.7.13
[root@localhost mysql-5.7.13]# 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=1
...
CMake Error
at
cmake/boost.cmake:81 (MESSAGE):
You can downloadit
with
-DDOWNLOAD_BOOST=1-DWITH_BOOST=
This CMake script willlook
for
boost
in
. If it
is
not
there,
it will download
and
unpack it (
in
thatdirectory)
for
you.
If you are inside afirewall, you may need
to
use an httpproxy:
exporthttp_proxy=http://example.com:80
Call Stack (most recent call
first
):
cmake/boost.cmake:238(COULD_NOT_FIND_BOOST)
CMakeLists.txt:451(INCLUDE)
-- Configuring incomplete, errors occurred!
|
注:重新运行配置,需要删除CMakeCache.txt文件
解决:
(1)在预编译时添加相应的选项:cmake -DDOWNLOAD_BOOST=1-DWITH_BOOST=/usr/local/boost
(2)或者下载一个boost包,放到/usr/local/boost目录下,然后在cmake后面加选项-DWITH_BOOST=/usr/local/boost
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@localhost mysql-5.7.13]
# cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=gbk-DDEFAULT_COLLATION=gbk_chinese_ci -DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1-DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306-DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1-DWITH_BOOST=/usr/local/boost
....
CMake Error atcmake
/readline
.cmake:64(MESSAGE):
Curses library not found.Please
install
appropriatepackage,
remove CMakeCache.txt andrerun cmake.On Debian
/Ubuntu
, packagename is libncurses5-dev, on Redhat and derivates it isncurses-devel.
Call Stack (most recentcall first):
cmake
/readline
.cmake:107(FIND_CURSES)
cmake
/readline
.cmake:181(MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:479(MYSQL_CHECK_EDITLINE)
-- Configuringincomplete, errors occurred!
See also
"/usr/local/src/mysql-5.7.13/CMakeFiles/CMakeOutput.log"
.
See also
"/usr/local/src/mysql-5.7.13/CMakeFiles/CMakeError.log"
.
|
(1)安装ncurses-devel
yum -y install ncurses-devel
(2)删除CMakeCache.txt
rm CMakeCache.txt
(3)重新cmake
复制代码 代码如下:
[root@localhost mysql-5.7.13]# cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_UNIX_ADDR=mysql.mysql -DDEFAULT_CHARSET=gbk-DDEFAULT_COLLATION=gbk_chinese_ci -DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1-DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306-DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1-DWITH_BOOST=/usr/local/boost
复制代码 代码如下:
[root@localhost mysql-5.7.13]# make[root@localhostmysql-5.7.13]# make install
默认密码位置
/root/.mysql_secret
启动命令
mysqld_safe --defaults-file=data/conf/mysql.cnf >/dev/null2>&1 &
登录命令
mysql --default-character-set=utf8--socket=/usr/local/mysql/data/mysql.sock -uroot -p"123456"
修改密码
update mysql.user set authentication_string=PASSWORD('123456')where user='root' and host='localhost';
mysqld_safe --defaults-file=data/conf/mysql.cnf >/dev/null2>&1 &
登录命令
mysql --default-character-set=utf8--socket=/usr/local/mysql/data/mysql.sock -uroot -p"123456"
修改密码
update mysql.user set authentication_string=PASSWORD('123456')where user='root' and host='localhost';
权限修改
GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITHGRANT OPTION;
创建新的实例
mysqld --initialize-insecure --user=mysql
--datadir=/mysql/data
--basedir=/usr/local/mysql
--socket=/tmp/mysql.sock
//在MySQL
5.7.6版本以前是
bin/mysql_install_db
--user
mysqld --initialize-insecure