当前位置:网站首页>mysql8 installation under linux
mysql8 installation under linux
2022-07-30 19:37:00 【m0_67401382】
mysql8 installation under linux
Download the installation package
Download address: https://dev.mysql.com/downloads/mysql/
Upload to the linux server or download directly on the server through get
Unzip the installation package
Unzip the installation package just downloaded and rename the directory to: mysql8
Directory path: /data/mysql8
Create data directory: /data/mysql8/data
Create mysql user and give permission
groupadd mysql
useradd -g mysql mysql
mkdir /var/lib/mysql
mkdir /data/mysql8/log
touch /data/mysql8/log/mysql.log
chown -R mysql.mysql /data/mysql8
chown -R mysql.mysql /var/lib/mysql
Initialize data
Enter the decompressed bin directory: /data/mysql8/bin and execute the following command (note: the root password printed on the console when the command below is executed needs to be written down and used later. For example, [email protected]: password)
./mysqld --user=mysql --basedir=/data/mysql8 --datadir=/data/mysql8/data/ --initializ
Note: Commands not found by "libaio.so.1" will be reported here.Install and solve by yum install libaio*, then re-execute the above command
Modify configuration
After initialization, the configuration file /etc/my.cnf will be generated.Modify it with vi /etc/my.cnf
The main increase configuration is as follows:
basedir=/data/mysql8
datadir=/data/mysql8/data
#Modify the directory to solve the problem that localhost cannot beConnection problems
socket=/var/lib/mysql/mysql.sock
[mysqld_safe]
log-error=/data/mysql8/log/mysql.log
pid-file=/data/mysql18/log/mysql.pid
[client]
#Modify the directory to solve the problem that localhost cannot be connected
socket=/var/lib/mysql/mysql.sock
The complete configuration is as follows:
[mysqld]basedir=/data/mysql8datadir=/data/mysql8/datasocket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# lower_case_table_names=1character_set_server=utf8mb4init_connect='SET collation_connection=utf8mb4_unicode_ci'init_connect='SET NAMES utf8mb4'collation-server=utf8mb4_unicode_ciskip-character-set-client-handshake# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group,# customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd[mysqld_safe]log-error=/data/mysql8/log/mysql.logpid-file=/data/mysql18/log/mysql.pid## include all files from the config directory#!includedir /etc/my.cnf.d[client]default-character-set=utf8mb4#Modify the directory to solve the problem that localhost cannot be connectedsocket=/var/lib/mysql/mysql.sock[mysql]default-character-set=utf8mb4Set environment variables
vi /etc/profile
Add at the end:
export MYSQL_PATH=/data/mysql8/bin/
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/data/mysql8/bin'
Finally, remember to execute: source /etc/profile
Register mysql as a service
cp /data/mysql8/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
Add mysql to startup
chkconfig --add mysql
chkconfig --list
Note: If the result of the chkconfig --list command mysql items 3 4 5 are all on, it is successful, otherwise it can be repaired by chkconfig --level 345 mysql onThe
Start mysql service
service mysql start
Change root account password
Log in to myql: mysql -hlocalhost -uroot -p
Enter the initialized password above
Modify the root default password: ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password'
Note:Must be modified, no modification is allowed to perform other operations
At this point, the installation is complete. If you need to connect to other machines, you need to create a user and give permissions, refer to the "other commands" below as needed.
Other commands
Create database: CREATE DATABASE database name;
Create user: create user 'user name' identified by 'password'
Set root user remote access: first use mysql; then update user set host='%' where user='root';
Give database permissions: grant all privileges on database name.* to 'utest'@'%';
Refresh permissions: flush privileges; remember to use this command to refresh after modifying permissionslower permissions
Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
- The problem of writing go run in crontab does not execute
- 谷歌AlphaFold近日宣称预测出地球上几乎所有蛋白质结构
- Talking about Contrastive Learning (Contrastive Learning) the first bullet
- Another company interview
- 【科普】无线电波怎样传送信息?
- Start foreground Activity
- 监听开机广播
- 已删除
- 解决终极bug,项目最终能顺利部署上线。
- [PyTorchVideo Tutorial 01] Quickly implement video action recognition
猜你喜欢
![[Prometheus] An optimization record of the Prometheus federation [continued]](/img/5d/56e171b7a02584337a0cfe5c731fb2.png)
[Prometheus] An optimization record of the Prometheus federation [continued]

Cesium加载离线地图和离线地形

Golang logging library zerolog use record

MySQL分组后取最大一条数据【最优解】

The 17th "Revitalization Cup" National Youth Vocational Skills Competition - Computer Programmers (Cloud Computing Platform and Operation and Maintenance) Participation Review and Summary

nlohmann json 使用指南【visual studio 2022】

MySQL数据库————视图和索引

谷歌AlphaFold近日宣称预测出地球上几乎所有蛋白质结构

Linux下安装MySQL教程

青蛙跳台阶(递归和非递归)-------小乐乐走台阶
随机推荐
Trial writing C language sanbang
[flink] Error finishing Could not instantiate the executor. Make sure a planner module is on the classpath
Spark学习:用spark实现ETL
牛客刷题系列之进阶版(组队竞赛,排序子序列,倒置字符串, 删除公共字符,修理牧场)
nlohmann json 使用指南【visual studio 2022】
[Prometheus] An optimization record of the Prometheus federation [continued]
Zabbix 5.0 监控教程(一)
刷题记录----字符串
mysql慢查询优化
055 c# print
[Private Series] All kinds of strange problems encountered in daily PHP
win2003下FTP服务器如何搭建
在华为云,见证迷你世界的神奇觉醒
Talking about Contrastive Learning (Contrastive Learning) the first bullet
数据库索引:索引并不是万能药
MindSpore:【JupyterLab】查看数据时报错
WEBSOCKETPP使用简介+demo
Google's AlphaFold claims to have predicted almost every protein structure on Earth
Centos7 install mysql8
VS Code connects to SQL Server