当前位置:网站首页>Centos7.9 install MySQL 5.7 and set startup
Centos7.9 install MySQL 5.7 and set startup
2022-06-27 06:37:00 【fyihdg】
Catalog
1、 download
Download address :
MySQL :: Download MySQL Community Serverhttps://dev.mysql.com/downloads/mysql/5.7.html
Or download it here :
After downloading , Upload to server :
2、 install
Check if it has been installed mysql
rpm -qa|grep mysql
It's not installed
Check the system's own Mariadb
rpm -qa|grep mariadb
Unload the system Mariadb
establish mysql User groups and users
groupadd mysql
useradd -r -g mysql mysql
Carry out orders :
tar -xvf mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz -C /opt
Switch to /ope Catalog
Modify name
mv mysql-5.7.38-linux-glibc2.12-x86_64/ mysql5.7
Modify the permissions , User group
chown -R mysql:mysql /opt/mysql5.7
chmod -R 755 /opt/mysql5.7
Get into :/opt/mysql5.7/bin, perform
./mysqld --initialize --user=mysql --datadir=/opt/mysql5.7/data --basedir=/opt/mysql5.7
New file :
vi /etc/my.cnf
Write the following :
[mysqld]
datadir=/opt/mysql5.7/data
port = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links=0
max_connections=400
innodb_file_per_table=1
# Table name case unknown , Sensitivity is
lower_case_table_names=1
to grant authorization
chmod -R 775 /etc/my.cnf
Modify file :
vi /opt/mysql5.7/support-files/mysql.server
Start the service :
/opt/mysql5.7/support-files/mysql.server start
root 23261 21419 0 22:01 pts/0 00:00:00 grep --color=auto mysqld
[[email protected] support-files]# /opt/mysql5.7/support-files/mysql.server start
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
Starting MySQL.my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
Logging to '/opt/mysql5.7/data/node05.err'.
ERROR! The server quit without updating PID file (/opt/mysql5.7/data/node05.pid).
Wrong report , There are reasons
1、 Data directory mysql The user does not have permission
2、/etc/my.cnf Configuration file configuration error ,[mysqld] Next set this line :datadir = /opt/mysql/data
3、 And that is /etc/ Format problem my.cnf
After successful startup :
Add soft connection , And restart mysql service
ln -s /opt/mysql5.7/support-files/mysql.server /etc/init.d/mysql
ln -s /opt/mysql5.7/bin/mysql /usr/bin/mysql
service mysql restart
3、 Connect mysql
User name is :root, The password is the password generated during the installation process
modify root password :
set password for [email protected] = password('root');
Open remote connection
use mysql;
update user set user.Host='%' where user.User='root';
flush privileges;
4、 Set boot up
Execute the following command
// Copy the service file to init.d Next , And rename to mysql
cp /opt/mysql5.7/support-files/mysql.server /etc/init.d/mysqld
// Give executable permission
chmod +x /etc/init.d/mysqld
// Add service
chkconfig --add mysqld
// Show the list of services
chkconfig --list
If it doesn't work , Turn off firewall :
# Turn on the firewall
systemctl start firewalld
# Turn off firewall
systemctl stop firewalld
perhaps
// to open up 3306 Port command
firewall-cmd --zone=public --add-port=3306/tcp --permanent
// Configuration takes effect immediately
firewall-cmd --reload
thus , Installation successful
边栏推荐
- Configuration of vscode korofileheader
- 解决 Win10 Wsl2 IP 变化问题
- Quick realization of Bluetooth ibeacn function
- 卷积神经网络---CNN模型的应用(找矿预测)
- Unrecognized VM option ‘‘
- EasyExcel:读取Excel数据到List集合中
- Instance Tunnel 使用
- Information System Project Manager - Chapter VII project cost management
- 路由器和交换机的区别
- 高斯分布Gaussian distribution、線性回歸、邏輯回歸logistics regression
猜你喜欢
JVM garbage collection mechanism
JVM整体结构解析
Distribution gaussienne, régression linéaire, régression logistique
快速实现单片机和手机蓝牙通信
Cloud-Native Database Systems at Alibaba: Opportunities and Challenges
Dev++ 环境设置C语言关键字显示颜色
Us camera cloud service scheme: designed for lightweight video production scenes
On gpu: historical development and structure
JVM对象组成和存储
IDEA中关于Postfix Completion代码模板的一些设置
随机推荐
机 器 学 习
When there are multiple El select, the selected value is filtered by El select, and the last selected value is filtered by the second El select
Spark sql 常用时间函数
Convolution neural network -- Application of CNN model (ore prospecting prediction)
2022 CISP-PTE(二)SQL注入
Fast realization of Bluetooth communication between MCU and mobile phone
multiprocessing. Detailed explanation of pool
Mathematical modeling contest for graduate students - optimal application of UAV in rescue and disaster relief
Transaction overview of tidb
JVM对象组成和存储
Altium designer 19 device silk screen label position shall be placed uniformly in batches
快速实现蓝牙iBeacn功能详解
Maxcompute SQL 的查询结果条数受限1W
Quick personal site building guide using WordPress
TiDB与 MySQL 兼容性对比
Thesis reading skills
AHB2APB桥接器设计(2)——同步桥设计的介绍
Cloud-Native Database Systems at Alibaba: Opportunities and Challenges
C Primer Plus Chapter 11_ Strings and string functions_ Codes and exercises
2022 cisp-pte (I) document contains