时间:2021-07-01 10:21:17 帮助过:1人阅读
4.拷贝MySQL启动脚本以及配置文件。
[root@node1 ~]# mv /etc/my.cnf /etc/my.cnf.bak
[root@node1 ~]# cp /usr/local/mysql57/support-files/my-default.cnf /etc/my.cnf
[root@node1 ~]# cp /usr/local/mysql57/support-files/mysql.server /etc/init.d/mysql57
[root@node1 ~]# chmod +x /etc/init.d/mysql57
[root@node1 ~]# sed -i ‘/^basedir=/s;$;/usr/local/mysql57;‘ /etc/init.d/mysql57
[root@node1 ~]# sed -i ‘/^datadir=/s;$;/dbdata;‘ /etc/init.d/mysql57
5.启动MySQL57数据库,设置开机启动。
[root@node1 ~]# service mysql57 start
[root@node1 ~]# chkconfig --add mysql57 && chkconfig --level 35 mysql57 on
6.登陆数据库,修改root密码为:xkops。
①.方法一:
mysql> set password=password(‘xkops‘);
Query OK, 0 rows affected, 1 warning (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
②.方法二:
mysql> select user,host,authentication_string from mysql.user;
+-----------+-----------+---------------------------------------------------------------------+
| user | host | authentication_string |
+-----------+-----------+--------------------------------------------------------------------+
| root | localhost | *5E4D24E68984D0087C9CB26B4658E832450D27BB |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
+-----------+-----------+--------------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> update mysql.user set authentication_string=password(‘xkops‘) where user=‘root‘ and host=‘localhost‘;
Query OK, 0 rows affected, 1 warning (0.01 sec)
Rows matched: 1 Changed: 0 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
*注释:在新的版本中密码字段更改为:authentication_string.
二、源码部分
1.下载软件包。
[root@node1 ~]# yum -y install gcc gcc-c++ make cmake ncurses-devel
[root@node1 ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz
2.configure配置。
[root@node1 ~]# tar xf mysql-5.7.13.tar.gz
[root@node1 ~]# cd mysql-5.7.13
[root@node1 mysql-5.7.13]# cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql57/ \
-DMYSQL_DATADIR=/dbdata\
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=$HOME/my_boost
*注释:如果cmake出错,执行如下操作,然后重新配置。
[root@node1 mysql-5.7.13]# make clean
[root@node1 mysql-5.7.13]# rm -rf CMakeCache.txt
3.编译&安装
[root@node1 mysql-5.7.13]# make -j 2 && make install
其他步骤参照二进制安装方式配置。
linux安装MySQL5.7.13(二进制|源码)
标签: