当前位置:网站首页>Complete mysql offline installation in 5 minutes
Complete mysql offline installation in 5 minutes
2022-08-05 06:20:00 【Sun Wenwen】
1. 场景描述
mysqlOffline installation is not complicated,It's just that there are often leaks,Sometimes for half a day,总结下,快速离线安装mysql,Just type the following command directly,5-10Install in minutes.
2. 解决方案
安装的mysql版本为:5.7,官网下载的gz包为:mysql-5.7.24-el7-x86_64.tar.gz.
2.1 安装
Mainly upload files、解压、Create new users, etc..
2.1.1 详细命令
1. gz文件上传到目录: /usr/local/2. 解压 cd /usr/local/ tar -zxvf mysql-5.7.24-el7-x86_64.tar.gz mkdir mysql mv mysql-5.7.24-el7-x86_64/* mysql rm -rf mysql-5.7.24-el7-x86_64 rm -rf mysql-5.7.24-el7-x86_64.tar.gz 3.新建mysql用户 groupadd mysql //创建用户组 useradd -r -g mysql mysql //-r参数表示mysql用户是系统用户,Not available for login,Create users and add user groups chown -R mysql mysql/ chgrp -R mysql mysql/
2.1.2 效果图
2.2 配置参数
主要是配置my.cnf文件
2.2.1 详细命令
vi /etc/my.cnf内容如下,You can add the configuration you need:[client]port = 3306socket = /tmp/mysql.sock[mysqld]character_set_server=utf8init_connect='SET NAMES utf8'basedir=/usr/local/mysqldatadir=/usr/local/mysql/datasocket=/tmp/mysql.socklog-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid#不区分大小写lower_case_table_names = 1sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONmax_connections=5000default-time_zone = '+8:00'保存内容,按esc输入如下命令:wq!
2.2.2 效果图:
2.3 初始化命令
---------------20191023更新-----------
Go back and use the tutorial to install again,Two pits were found,记录下,root账户执行
yum install libaiocd /var/log/vi mysqld.log:wqchmod 777 mysqld.logchown mysql:mysql mysqld.log-----------------------cd /var/run/mkdir mysqldchmod 777 mysqldcd mysqldvim mysqld.pidchmod 777 mysqld.pidchown mysql:mysql mysqld.pid
然后再执行初始化:
/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --lc_messages_dir=/usr/local/mysql/share --lc_messages=en_US
执行成功后,View the default initialization password
查看初始密码cat /var/log/mysqld.logBasically the last place:A temporary password is generated for [email protected]: B2iSyfs;d(dT其中B2iSyfs;d(dT,就是初始密码([email protected]: 这里就是初始密码)
2.4 完成配置,启动服务
使用mysql用户启动
su - mysql输入密码/usr/local/mysql/support-files/mysql.server start
启动完成后,可以用pscommand to see if it has started successfully.
2.5 远程连接
mysql服务启动完成后,By default the remote client cannot connect,需要在linux环境下登录mysql,并执行相关命令.
/usr/local/mysql/bin/mysql -uroot -p mysql输入root密码:(B2iSyfs;d(dT)set password=password('laowang');UPDATE mysql.user SET Host = '%', User = 'root' WHERE (Host = 'localhost') AND (User = 'root');FLUSH PRIVILEGES;
2.6 设置开机自动启动
cd /usr/local/mysql/support-filescp mysql.server /etc/init.d/mysqldchkconfig --add mysqld
2.7 其他(Service restart commands, etc)
su - mysqlservice mysqld start/stop/restart
END/历史推荐:
1. Registration center and gateway selection and complete deployment in the era of microservices
2. Alibaba Cloud's data center
3. springcloud-路由网关Zuul
4. Back-end separation before software developmentSwagger2
5. 数据库架构介绍
6. rabbitmq部署及使用
I’m 「软件老王」,IT技术及相关干货分享,If you like my article, please follow and forward it!
边栏推荐
- Mina的长连接和短连接
- Billions of IT operations in the market, the product by strength to speak
- 程序员应该这样理解I/O
- selenium学习
- IP address and subnet division
- Operation and maintenance engineer, come and pick up the wool
- [Day5] Soft and hard links File storage, deletion, directory management commands
- sql server 重复值在后面计数
- [Day1] VMware software installation
- The spark operator - coalesce operator
猜你喜欢
Take you in-depth understanding of cookies
运维的高光时刻,从智能化开始
What are some things that you only know when you do operation and maintenance?
Configuration of TensorFlow ObjecDetectionAPI under Anaconda3 of win10 system
传输层协议
VLAN details and experiments
spark source code - task submission process - 1-sparkSubmit
NIO工作方式浅析
[Day1] VMware software installation
初识网页与浏览器
随机推荐
LeetCode面试题
The problem of calling ds18b20 through a single bus
I/O性能与可靠性
微信小程序页面跳转传参
Tencent greetings function SCF - entry instructions
[Day5] Soft and hard links File storage, deletion, directory management commands
深度 Zabbix 使用指南——来自惨绿少年
Getting Started Document 09 Standalone watch
VLAN详解及实验
Switch principle
wc、grep、tar、vi/vim
Wechat applet page jump to pass parameters
Does flink cdc currently support Gauss database sources?
Wireshark packet capture and common filtering methods
Why can't I add a new hard disk to scan?How to solve?
技术分享杂七杂八技术
入职前,没想到他们玩的这么花
OpenCV3.0 is compatible with VS2010 and VS2013
Proprietary host CDH
sql server 重复值在后面计数