下面讲讲关于centso7.2源码方式安装mysql的几个步骤,文字的奥妙在于贴近主题相关。所以,闲话就不谈了,我们直接看下文吧,相信看完centso7.2源码方式安装mysql的几个步骤这篇文章你一定会有所受益。
源码方式安装 mysql-boost-5.7.17.tar.gz
1、 准备工作
关闭SELinux, 防火墙 下载软件包 ------>https://www.mysql.com/
卸载自带的mariadb
2、卸载系统自带的mariadb软件
[root@mysqltest ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.44-2.el7.centos.x86_64
[root@mysqltest ~]# rpm -e --nodeps mariadb-libs
3、创建数据目录 /mydata/data
[root@mysqltest ~]# mkdir -p /mydata/data
修改数据目录的所属
[root@node02 ~]# useradd -s /sbin/nologin -M mysql
[root@node02 ~]# chown -R mysql.mysql /mydata/data/
4、安装cmake编译器
[root@node02 ~]# yum install -y cmake
[root@node02 ~]# tar zxf mysql-boost-5.7.17.tar.gz
cmake. -L 查看cmake支持的编译选项
[root@node02 ~]# cd mysql-5.7.17/
[root@mysql57 mysql-5.7.17]# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_DATADIR=/mydata/data \
-DMYSQL_TCP_PORT=3306 \
-DWITH_BOOST=boost/boost_1_59_0/ \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
错误1:
CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
CMake Error at cmake/os/Linux.cmake:41 (MESSAGE):
Unsupported compiler!
Call Stack (most recent call first):
CMakeLists.txt:162 (INCLUDE)
解决办法:
# yum groupinstall -y "Development Tools" "Server Platform Development" "Desktop Platform Development"
错误2:
CMake Error at cmake/readline.cmake:64 (MESSAGE):
Curses library not found. Please install appropriate package,
解决办法:
[root@node02 ~]# yum install -y ncurses-devel.x86_64
[root@mysqltest mysql-5.7.17]# make
[root@mysqltest mysql-5.7.17]# make install
[root@mysqltest ~]# chown -R root.mysql /usr/local/mysql/
5、初始化数据库
[root@mysql57 ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/mydata/data
6、复制MySQL配置文件
[root@node02 ~]# cd /usr/local/mysql/support-files/
[root@node02 support-files]# cp my-default.cnf /etc/my.cnf
[root@node02 support-files]# vim /etc/my.cnf
[mysqld]
...
basedir=/usr/local/mysql
datadir=/mydata/data
port=3306
server_id=121
socket=/tmp/mysql.sock
7、启动mysql服务
[root@mysqltest data]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[root@mysqltest data]# ss -antp | grep mysqld
LISTEN 0 80 :::3306 :::* users:(("mysqld",pid=63756,fd=20))
[root@mysqltest data]#
8、修改环境变量PATH
[root@mysqltest] export PATH=$PATH:/usr/local/mysql/bin 临时的
[root@mysqltest] echo $PATH
[root@mysqltest data]# cat /etc/profile.d/mysql.sh
export PATH=$PATH:/usr/local/mysql/bin
[root@mysqltest data]# source /etc/profile.d/mysql.sh
[root@mysqltest data]# mysql -u root -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Www.1.com';
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
9、设置源码mysql服务开机自启动
# vim /etc/rc.d/rc.local
/usr/local/mysql/bin/mysqld_safe --user=mysql &
对于以上centso7.2源码方式安装mysql的几个步骤相关内容,大家还有什么不明白的地方吗?或者想要了解更多相关,可以继续关注我们的行业资讯板块。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。