Installation steps
1. Unzip the installation package
tar -xf mysql-8.0.33-el7-x86_64.
2. Move the unzipped folder
mv mysql-8.0.33-el7-x86_64 mysql mv mysql /usr/local/
3. Create MySQL User
useradd -s /sbin/nologin mysql
4. Set permissions
chown -R mysql:mysql /usr/local/mysql/ chown mysql:mysql /etc/
5. Configure MySQL
edit/etc/
File, overwrite the following configuration (the original configuration can be commented out):
# Client Configuration[client] port = 3306 # The default port for MySQL client connectionsocket=/usr/local/mysql/ # MySQL client connection socket file path# MySQL Server Configuration[mysqld] user = mysql # System user running MySQL servicebasedir=/usr/local/mysql # Path to MySQL installation directorydatadir=/usr/local/mysql/data # MySQL data file storage directoryport = 3306 # The port number of MySQL server listeningcharacter-set-server=utf8 # Server-side default character setpid-file = /usr/local/mysql/ # Path to the MySQL server process ID filesocket=/usr/local/mysql/ # The socket file path used by MySQL serverbind-address = 0.0.0.0 # The IP address bound to the MySQL server, 0.0.0.0 means listening to all available network interfacesskip-name-resolve # Disable DNS resolution to improve connection speed, but may cause connection to be unable to be used with the hostnamemax_connections=2048 # Maximum number of concurrent connections alloweddefault-storage-engine=INNODB # The default storage engine is set to InnoDBmax_allowed_packet=16M # The maximum allowed packet size, unit in bytesserver-id = 1 # Unique identifier in MySQL replication, used for master-slave replicationsql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION # SQLMode settings,DefinedMySQLHow to deal with itSQLStatement
6. Set environment variables
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile source /etc/profile
7. Initialize the database
cd /usr/local/mysql/bin/ ./mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
8. Set up system services
cp /usr/local/mysql/support-files/ /etc//mysqld chmod +x /etc//mysqld systemctl daemon-reload systemctl restart mysqld
9. Set the root password
mysqladmin -u root password "123456"
10. Log in to MySQL and configure remote access
mysql -u root -p123456
Execute in MySQL shell:
CREATE USER 'root'@'%' IDENTIFIED BY '123456'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; flush privileges; ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
Notice
- Security: In production environment, be sure to set a strong password and restrict remote access.
- Firewall: Ensure that the server's firewall allows traffic to port 3306.
- SELinux: If SELinux is enabled, additional configuration may be required to allow MySQL's network access.
- Backup: Be sure to back up the database before modifying the configuration or performing important operations.
This is the article about the mySQL 8.0.33 installation guide. For more related contents of the mySQL 8.0.33 installation guide, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!