OEL7.6源码安装MYSQL5.7的教程
程序员文章站
2022-04-06 09:52:43
首先官网下载安装包
然后上传解压至/usr/local目录
[root@localhost db]# tar -xf mysql-5.7.26-linux-...
首先官网下载安装包
然后上传解压至/usr/local目录
[root@localhost db]# tar -xf mysql-5.7.26-linux-glibc2.12-x86_64.tar [root@localhost db]# tar -xzf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz [root@localhost db]# mv mysql-5.7.26-linux-glibc2.12-x86_64 /usr/local/mysql [root@localhost db]#
然后创建mysql用户和组以及数据目录
[root@localhost db]# mv mysql-5.7.26-linux-glibc2.12-x86_64 /usr/local/mysql [root@localhost db]# groupadd mysql [root@localhost db]# useradd mysql -g mysql [root@localhost db]# cd /usr/local/mysql [root@localhost mysql]# mkdir data [root@localhost mysql]# chown mysql: -r /usr/local/mysql/ [root@localhost mysql]#
然后初始化数据并记录临时密码
[root@localhost mysql]# bin/mysqld --initialize --user=mysql --datadir /usr/local/mysql/data 2019-07-26t01:34:24.479757z 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2019-07-26t01:34:24.682695z 0 [warning] innodb: new log files created, lsn=45790 2019-07-26t01:34:24.717419z 0 [warning] innodb: creating foreign key constraint system tables. 2019-07-26t01:34:24.723157z 0 [warning] no existing uuid has been found, so we assume that this is the first time that this server has been started. generating a new uuid: 8009a802-af45-11e9-839c-000c29984aae. 2019-07-26t01:34:24.723996z 0 [warning] gtid table is not ready to be used. table 'mysql.gtid_executed' cannot be opened. 2019-07-26t01:34:24.724629z 1 [note] a temporary password is generated for root@localhost: ucz5w5zksq;1 [root@localhost mysql]#
然后修改/etc/my.cnf配置文件中datadir为/usr/local/mysql/data
[root@localhost mysql]# cat /etc/my.cnf [mysqld] datadir=/usr/local/mysql/data [root@localhost mysql]#
然后将mysql加入init.d目录并启动mysql
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld [root@localhost mysql]# /etc/init.d/mysqld start starting mysql.logging to '/usr/local/mysql/data/localhost.localdomain.err'. success! [root@localhost mysql]# ps -ef|grep mysql root 12957 1 0 09:37 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/localhost.localdomain.pid mysql 13057 12957 4 09:37 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=localhost.localdomain.err --pid-file=/usr/local/mysql/data/localhost.localdomain.pid root 13092 10198 0 09:37 pts/0 00:00:00 grep --color=auto mysql [root@localhost mysql]#
最后mysql/bin加入path,并登陆数据库并重设密码
[root@localhost bin]# ./mysql -u root -p enter password: welcome to the mysql monitor. commands end with ; or \g. your mysql connection id is 2 server version: 5.7.26 copyright (c) 2000, 2019, oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of oracle corporation and/or its affiliates. other names may be trademarks of their respective owners. type 'help;' or '\h' for help. type '\c' to clear the current input statement. mysql> set password=password('mysql'); query ok, 0 rows affected, 1 warning (0.00 sec) mysql> exit bye [root@localhost bin]# ./mysql -u root -p enter password: error 1045 (28000): access denied for user 'root'@'localhost' (using password: yes) [root@localhost bin]# ./mysql -u root -p enter password: welcome to the mysql monitor. commands end with ; or \g. your mysql connection id is 4 server version: 5.7.26 mysql community server (gpl) copyright (c) 2000, 2019, oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of oracle corporation and/or its affiliates. other names may be trademarks of their respective owners. type 'help;' or '\h' for help. type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec) mysql>
ojbk,then have fun!
总结
以上所述是小编给大家介绍的oel7.6源码安装mysql5.7的教程,希望对大家有所帮助
上一篇: VMware虚拟化kvm安装部署教程小结
下一篇: MySQL不停地自动重启的解决方法
推荐阅读
-
Windows系统下安装Python的SSH模块教程
-
win10免安装版本的MySQL安装配置教程
-
win7系统安装网银助手时提示您尚未正确安装错误的两种解决方法图文教程
-
Python2.7.10以上pip更新及其他包的安装教程
-
Nginx服务器上安装并配置PHPMyAdmin的教程
-
在 Ubuntu 上安装 Protobuf 3 的教程详解
-
猎豹浏览器无法在WIN8下安装 WIN8下安装不了猎豹浏览器的解决办法(图文教程)
-
mysql-8.0.16 winx64的最新安装教程图文详解
-
windows版本下mysql的安装启动和基础配置图文教程详解
-
Mac系统下源码编译安装MySQL 5.7.17的教程