当前位置:网站首页>Installing MySQL under Linux (CentOS 7)

Installing MySQL under Linux (CentOS 7)

2022-06-25 20:12:00 chinrock

download mysql Installation package

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

install

 yum -y install mysql57-community-release-el7-10.noarch.rpm

install mysql service

 yum -y install mysql-community-server

start-up mysql service

systemctl start mysqld.service

see mysql Log when the service is started , Match view password , Then log in

 grep "password" /var/log/mysqld.log

Sign in mysql

mysql -u root -p

Remember to change the password after login

alter user 'root'@'localhost' identified by 'root';# Password rules are all used 

# uninstall Yum Repository

 yum -y remove mysql57-community-release-el7-10.noarch

#mysql Common commands

systemctl start mysqld.service # Opening service 
systemctl stop mysqld.service # Close the service 
systemctl status mysqld.service # View service status 
mysql -u root -p # Get into mysql Command window 
mysql> show databases; # View all databases 
mysql> use  Database name ; # Use this data for editing 
mysql> show tables; # View all tables in a database 

1. Remote connection database , use navicat Remote connection database error 1103

Need to open the firewall 3306 port

zone Scope
add-port=80/tcp Add port , port / Communication protocol
permanent permanent ( Restart without this parameter is invalid )

sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent

Turn on 3306 After the port , Firewall must be restarted ,naivcat You can connect to MySQL Database

sudo systemctl restart firewalld.service

Create a remote connection user root; password :root

mysql -uroot -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
flush privileges;

Finally, the connection was successful

原网站

版权声明
本文为[chinrock]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202190506319861.html