当前位置:网站首页>Linux Installation mysql8
Linux Installation mysql8
2022-06-29 19:49:00 【A vegetable chicken that is working hard】
uninstall MariaDB
1. Check
rpm -qa|grep mariadb
2. uninstall
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
3. Check if the unloading is clean
rpm -qa|grep mariadb
install MySQL
1. Two ways to install
- Download and install manually on the official website
Official website address :https://dev.mysql.com/downloads/mysql/
After downloading, drag to Linux Of /usr/local

- network install
cd /usr/local
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz
2. decompression
.tar.gz suffix :tar -zxvf file name
.tar.xz suffix :tar -Jxvf file name
3. rename
mv Original folder name mysql8
4. Configure environment variables
- vim /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_152
JRE_HOME=/usr/java/jdk1.8.0_151/jre
HADOOP_HOME=/usr/local/hadoop-2.7.1
ZOOKEEPER_HOME=/usr/local/zookeeper-3.3.6
FLUME_HOME=/usr/local/flume-1.9.0
NGINX_HOME=/usr/local/nginx
TOMCAT_HOME=/usr/local/tomcat-8.5.81
MYSQL8_HOME=/usr/local/mysql8
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$ZOOKEEPER_HOME/bin:$FLUME_HOME/bin:$NGINX_HOME/sbin:$TOMCAT_HOME/bin:$MYSQL8_HOME/bin
export PATH CLASSPATH JAVA_HOME JRE_HOME HADOOP_HOME ZOOKEEPER_HOME FLUME_HOME NGINX_HOME TOMCAT_HOME MYSQL8_HOME
- source /etc/profile
5. Users and user groups
- Create a user group :mysql
groupadd mysql
- Create a system user :mysql, Specify the user group as mysql
useradd -r -g mysql mysql
-r: Create system user
-g: Specify user groups
6. Data directory
- Create directory
cd /usr/local/mysql8
mkdir datas
- Change owner and array
chown -R mysql:mysql /usr/local/mysql8/datas
- Change mode
chmod -R 750 /usr/local/mysql8/datas
initialization MySQL
1. Configuration parameters
- cd /usr/local/mysql8
- vim my.cnf
[mysql]
# Default character set
default-character-set=utf8mb4
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
server-id = 3306
user = mysql
socket = /tmp/mysql.sock
# The installation directory
basedir = /usr/local/mysql8
# Data storage directory
datadir = /usr/local/mysql8/datas/mysql
log-bin = /usr/local/mysql8/datas/mysql/mysql-bin
innodb_data_home_dir =/usr/local/mysql8/datas/mysql
innodb_log_group_home_dir =/usr/local/mysql8/datas/mysql
# The storage directory of logs and process data
log-error =/usr/local/mysql8/datas/mysql/mysql.log
pid-file =/usr/local/mysql8/datas/mysql/mysql.pid
# The character set used by the server defaults to 8 Bit code
character-set-server=utf8mb4
lower_case_table_names=1
autocommit =1
################## The above to be modified ########################
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 1024
sort_buffer_size = 4M
net_buffer_length = 8K
read_buffer_size = 4M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 64M
thread_cache_size = 128
#query_cache_size = 128M
tmp_table_size = 128M
explicit_defaults_for_timestamp = true
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535
binlog_format=mixed
binlog_expire_logs_seconds =864000
# The default storage engine that will be used when creating a new table
default_storage_engine = InnoDB
innodb_data_file_path = ibdata1:10M:autoextend
innodb_buffer_pool_size = 1024M
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
transaction-isolation=READ-COMMITTED
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 4M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
2. initialization
- mysqld --defaults-file=/usr/local/mysql8/my.cnf --basedir=/usr/local/mysql8/ --datadir=/usr/local/mysql8/datas/mysql --user=mysql --initialize-insecure
defaults-file: Specify profile ( Put it on –initialize front )
user: Designated user
basedir: Specify the installation directory
datadir: Specify the initialization data directory
intialize-insecure: Initialization without password
start-up MySQL
1. see MySQL Of bin Under the path , Does it include mysqld_safe

2. Start the service
- Full command
/usr/local/mysql8/bin/mysqld_safe --defaults-file=/usr/local/mysql8/my.cnf &
- Command after adding environment variables
mysqld_safe --defaults-file=/usr/local/mysql8/my.cnf &
3. See if it starts
- ps -ef|grep mysql

Sign in
1. No password login mode
- /usr/local/mysql8/bin/mysql -u root --skip-password

2. There is a password login method ( The initial random password is /data/mysql8_data/mysql/mysql.log Next )
- mysql -u root -p
- password: Random cipher
Change Password
1. Change Password
- ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password
BY ‘a’;
2. Refresh the permissions
- FLUSH PRIVILEGES;
Set allow remote login
1. Set up
- use mysql
- update user set user.Host='%'where user.User=‘root’;
- flush privileges;
- quit
2.Navicat test


边栏推荐
- Snowflake ID, distributed unique ID
- MBA-day19 如果p则q矛盾关系p 且非q
- 命令执行(RCE)漏洞
- Classic illustration of K-line diagram (Collection Edition)
- Mba-day19 if P then q contradictory relation P and not Q
- How important is it to make a silver K-line chart?
- Notepad++--宏(记录操作过程)
- Inception 新结构 | 究竟卷积与Transformer如何结合才是最优的?
- Static static member variables use @value injection
- Automatically obtain local connection and network address modification
猜你喜欢
![[software testing] 01 -- software life cycle and software development model](/img/57/a4fcb40a33c80b0bcf2187d1943abd.jpg)
[software testing] 01 -- software life cycle and software development model

Exploration and practice of NLP problem modeling scheme

Creators foundation highlights in June
![[boutique] detailed explanation of Pinia](/img/94/d332e32dba54be3c2d3f6ff08a85fa.png)
[boutique] detailed explanation of Pinia

Lock4j -- distributed lock Middleware -- customize the logic of lock acquisition failure

童年经典蓝精灵之百变蓝爸爸数字藏品中奖名单公布

Flume配置1——基础案例

创作者基金会 6 月份亮点

QC protocol + Huawei fcp+ Samsung AFC fast charging 5v9v chip fs2601 application

ASP. Net core creates razor page and uploads multiple files (buffer mode) (Continued)
随机推荐
凌云出海记 | 文华在线&华为云:打造非洲智慧教学新方案
Deficiencies and optimization schemes in Dao
Automatically obtain local connection and network address modification
雲服務器的安全設置常識
[sword finger offer] 51 Reverse pair in array
ASP.Net Core创建Razor页面上传多个文件(缓冲方式)(续)
1404萬!四川省人社廳關系型數據庫及中間件軟件系統昇級采購招標!
Kdd 2022 | prise en compte de l'alignement et de l'uniformité des représentations dans le Filtrage collaboratif
Sophomore majoring in software engineering, the previous learning situation is not very good. How to plan the follow-up development route
如何设置 Pod 到指定节点运行
Understanding of software test logic coverage
JVM (3) class loading
How to set a pod to run on a specified node
【网络方向实训】-企业园区网络设计-【Had Done】
【观察】软通动力刘天文:拥抱变化“顺势而为”,做中国数字经济“使能者”...
KDD 2022 | 協同過濾中考慮錶征對齊和均勻性
IP error problem of PHP laravel using AWS load balancer
MSYQL, redis, mongodb visual monitoring tool grafana
lock4j--分布式锁中间件--自定义获取锁失败的逻辑
创作者基金会 6 月份亮点