mysql离线二进制安装
2021/11/9 19:40:06
本文主要是介绍mysql离线二进制安装,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
mysql离线二进制安装
清理环境:
# 检测是否安装过mysql rpm -qa | grep mysql # 删除命令 rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.x86_64 # 清除相关文件夹 whereis mysql rm -rf /usr/lib64/mysql /usr/share/mysql find / -name mysql rm -rf /etc/selinux/targeted/active/modules/100/mysql
1、下载安装包:(找个可以访问公网的机器下载,scp传给离线机)
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
2、创建用户
useradd -r mysql -M -s /bin/false
3、安装
tar zxf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz -C /usr/local/ mv /usr/local/mysql-5.7.26-linux-glibc2.12-x86_64/ /usr/local/mysql mkdir /usr/local/mysql/data chown -R mysql.mysql /usr/local/mysql/ cd /usr/local/mysql/ bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 2021-11-08T16:53:40.303955Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2021-11-08T16:53:40.737310Z 0 [Warning] InnoDB: New log files created, LSN=45790 2021-11-08T16:53:40.826236Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2021-11-08T16:53:40.904487Z 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: 6d06052a-40b4-11ec-890e-0800271838f4. 2021-11-08T16:53:40.965782Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2021-11-08T16:53:40.966618Z 1 [Note] A temporary password is generated for root@localhost: .Do+jldzK8t_ #初始密码:.Do+jldzK8t_
4、修改配置
vim /etc/my.cnf #注释所有,再添加如下内容 [mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data port=3306 socket=/usr/local/mysql/mysql.sock character-set-server=utf8 log-error=/var/log/mysqld.log pid-file=/tmp/mysqld.pid [mysql] socket=/usr/local/mysql/mysql.sock [client] socket=/usr/local/mysql/mysql.sock vim /etc/profile.d/mysql.sh export PATH=/usr/local/mysql/bin:$PATH #写入此一行 #保存刷新 source /etc/profile.d/mysql.sh cp support-files/mysql.server /etc/init.d/mysqld #配置使用service mysqld start/stop/restart命令管理mysql chmod +x /etc/init.d/mysqld vim /etc/init.d/mysqld basedir=/usr/local/mysql #第46行 补全安装目录 datadir=/usr/local/mysql/data #第47行 补全数据所在目录 /etc/init.d/mysqld start #启动
5、登录
#修改密码 mysqladmin -u root -p'初始密码' password '新密码' #新密码必须包含大小写英文、数字、特殊符号 #登录mysql mysq -u root -p'新密码'
这篇关于mysql离线二进制安装的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-20MySQL集群部署教程:入门级详解
- 2024-11-20MySQL集群教程:入门与实践指南
- 2024-11-20部署MySQL集群教程:新手入门指南
- 2024-11-20MySQL读写分离教程:轻松入门
- 2024-11-20部署MySQL集群入门:一步一步搭建你的数据库集群
- 2024-11-19部署MySQL集群学习:入门教程
- 2024-11-19如何部署MySQL集群:新手入门教程
- 2024-11-19Mysql安装教程:新手必看的详细安装指南
- 2024-11-18Mysql安装入门:新手必读指南
- 2024-11-18MySQL事务MVCC原理入门详解