In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the installation and testing of Mysql-rpm package, hoping to supplement and update some knowledge, if you have any other questions you need to know, you can continue to follow my updated article in the industry information.
I. New features
MySQL 5.7is an exciting milestone, adding new features such as ssl, json, virtual columns, and so on, to the default InnoDB engine. Compared with postgreSQL and MariaDB, MySQL5.7 has done a lot of "make-up" operations.
II. Upgrade operation
1. Uninstall the old version
1.1View MySQL
one
two
Rpm-qa | grep mysql
Rpm-qa | grep mariadb
1.2.Uninstall MySQL
one
two
three
four
Rpm-e-- nodeps mysql-5.1.73-7.el6.x86_64
Rpm-e-- nodeps mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
Rpm-e-- nodeps mysql-libs-5.1.73-7.el6.x86_64
Rpm-qa | grep mysql
1.3. Delete the data directory
one
two
Ls-l / var/lib | grep mysql
Rm-rf / var/lib/mysql
The data directory can be backed up and removed. The mysqld service checks if the data directory exists during initialization: if the data directory does not exist, mysqld creates it; if the data directory exists and is not empty (that is, contains files or subdirectories), mysqld displays an error message and aborts:
[ERROR]-initialize specified but the data directory exists. Aborting.
Note: this step can also be skipped.
2. Install MySQL5.7
2.1.Unpack MySQL5.7
one
Tar-xvf mysql-5.7.14-1.el6.x86_64.rpm-bundle.tar
By the way, the installation environment is CentOS6.5, so you should choose the el6 installation package; CentOS7 should choose the el7 installation package.
If the system version corresponding to the installation package is incorrect, a dependency error about glibc will occur during installation:
Warning: mysql-community-libs-5.7.14-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature,key ID 5072e1f5: NOKEY
Error: Failed dependencies:
Libc.so.6 (GLIBC_2.14) (64bit) is needed bymysql-community-libs-5.7.14-1.el7.x86_64
2.2. Install the RPM package according to the dependency
The dependency is common → libs → client → server in turn.
one
two
three
four
Rpm-ivh mysql-community-common-5.7.14-1.el6.x86_64.rpm
Rpm-ivh mysql-community-libs-5.7.14-1.el6.x86_64.rpm
Rpm-ivh mysql-community-client-5.7.14-1.el6.x86_64.rpm
Rpm-ivh mysql-community-server-5.7.14-1.el6.x86_64.rpm
Don't try to be lazy. Client also needs to be pretended.
3. Initialize MySQL5.7
3.1.Starting mysqld service
one
two
Cd.. / sbin is the / usr/sbin directory
Service mysqld start
There is no need to initialize manually. It takes a long time to start. Wait patiently.
3.2.Check the running status of mysqld
one
Service mysqld status
At this point, we can judge that the basic installation of MySQL is successful.
3.3. Find temporary login password
one
Vi / var/log/mysqld.log
You can also use this command to find cat / var/log/mysqld.log more quickly | grep password can log in to MySQL after finding a random password.
3.4. Log in
one
Mysql-uroot-p
Log in using your root account
4.1. change the root password
one
Alter user 'root'@'localhost' identified by' abc@123'
After 5.6, mysql has a built-in password enhancement mechanism, and low-strength passwords will report errors:
ERROR 1819 (HY000): Your password doesnot satisfy the current policy requirements
4.2. Add remote login users
one
two
Use mysql; (Note: this refers to using the library named mysql)
GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' abc@123' WITH GRANT OPTION
'%' represents any address, or you can specify IP
4.3. Check the user table and refresh the memory permissions
one
two
Select host, user from user
FLUSH PRIVILEGES
4.4. Set up a firewall
one
Vi / etc/sysconfig/iptables
Before-A RH-Firewall-1-INPUT-j REJECT-reject-with icmp-host-prohibited, add
one
-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 3306-j ACCEPT
4.5. Restart the firewall
one
Service iptables restart
Summary of common commands for Linux installation Mysql
Check to see if Mysql is installed:
Rpm-qa | grep mysql
Rpm-qa | grep mariadb
Delete command:
Rpm-evMySQL-server-5.7.14-1.linux2.6.i386
Rpm-evMySQL-client-5.7.14-1.linux2.6.i386
If you can't delete it, you can add-- nodeps to delete it.
Installation commands:
Rpm-ivh MySQL-server-5.7.14-1..linux2.6.i386.rpm
Error report during installation: Header V3DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Solution: rpm-ivhMySQL-server-5.7.14-1.el6.x86_64.rpm-- force-nodeps
You need to pay attention to the installation order of dependent packages here. If the installation order is correct, there are basically no errors, and forced installation is not recommended.
Linux set Firewall Command
Iptables is not only the firewall under linux, but also the service name.
Service iptables status View Firewall status
Service iptables start turn on the firewall
Service iptables stop, turn off the firewall
Service iptables restart restart Firewall
Firewalls open specific ports:
① file / etc/sysconfig/iptables
② add:
-An INPUT-m state-- state NEW-m tcp- p tcp--dport 8080-j ACCEPT (allows port 80 to pass through the firewall)
Special note: many netizens add these two rules to the last line of the firewall configuration, causing the firewall to fail to start, and the correct one should be added to the default port 22 rule.
-A RH-Firewall-1-INPUT-m state-- stateNEW-m tcp-p tcp-- dport 8080-j ACCEPT (not available)
The ★ number 8080 indicates that port 8080 is open, or it can be changed to another port ★.
③ restart Firewall
-An INPUT-m state-- state NEW-m tcp-ptcp-- dport 8080-j ACCEPT (allows port 80 to pass through the firewall)
Special note: many netizens add these two rules to the last line of the firewall configuration, causing the firewall to fail to start, and the correct one should be added to the default port 22 rule.
=
Save the settings for the firewall
Serivceiptables save
View iptables rules and numbers
Iptables-nL--line-number
Shut down all ports of all INPUT FORWARD (forwarding) OUTPUT
Iptables-PINPUT DROP
Iptables-PFORWARD DROP
Iptables-POUTPUT DROP
Open port 22 only
Iptables-An INPUT-p tcp-- dport 22-j ACCEPT
Iptables-AOUTPUT-p tcp-sport 22-j ACCEPT
Parameter explanation:
The-A parameter is treated as adding a rule
-p specifies what the protocol is. Our commonly used tcp protocol, of course, also has udp, such as DNS with port 53.
-dport is the target port. When data enters the CVM from outside, it is the target port.
-if sport data is sent out of the server, it will be used for the data source port
-j is specified as ACCEPT-receive or DROP does not receive
Disable a certain IP access
Iptables-AINPUT-p tcp-s 192.168.1.2-j DROP
-s parameter is the source (that is, 192.168.1.2)
The following refusal is DROP.
Delete a rule
Iptables-DINPUT 2
Delete the rule with INPUT chain number 2
Read the above about Mysql-rpm package installation and testing analysis, hope to give you some help in practical application. Due to the limited space in this article, it is inevitable that there will be deficiencies and need to be supplemented. If you need more professional answers, you can contact us on the official website for 24-hour pre-sales and after-sales to help you answer questions at any time.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.