Recently, I plan to deploy a cloud disk on my home server, so I started a series of environment setup operations. When installing MySQL, I found some differences from before, so I wrote them down to avoid searching for problems like today next time. 1. Uninstall the old version Use the following command to check whether MySQL Server is installed If yes, uninstall it with the following command rpm -e mysql //Normal deletion mode rpm -e --nodeps mysql //Forced deletion mode. If you are prompted to delete other dependent files when using the above command, you can use this command to forcefully delete them. Two: Install MySQL 1. Install dependencies 2. Get the source code (in China, it is recommended to download from Sohu's mirror http://mirrors.sohu.com/mysql... wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-boost-5.7.24.tar.gz tar xvf mysql-boost-5.7.24.tar.gz cd mysql-5.7.24 3. Compile and install cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/usr/local/mysql/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DDOWNLOAD_BOOST=1 -DWITH_BOOST=./boost make && make install For compilation parameters, please refer to http://dev.mysql.com/doc/refm.... Three: Configure MySQL Use the following command to check whether there is a mysql user and user group cat /etc/passwd #View the user list cat /etc/group #View the user group list If not, create groupadd mysql useradd -g mysql mysql Modify /usr/local/mysql permissions chown -R mysql:mysql /usr/local/mysql MySQL 5.7.18 and later no longer provides a default MySQL configuration file. Here we found a simple configuration on the Internet. vi /etc/my.cnf and then write the following content [client] port = 3306 default-character-set=utf8 [mysqld] # General configuration options basedir = /usr/local/mysql datadir = /usr/local/mysql/data port = 3306 character-set-server=utf8 default_storage_engine = InnoDB sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION Configure the service script cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql chkconfig mysql on #Add to startup items service mysql start #Start mysql Add the mysql executable file to the path directory, vi /etc/profile PATH=/usr/local/mysql/bin:$PATH export PATH Then execute source /etc/profile Four: Initialize mysql 1. Execute the initialization script (the last line of the initialization will generate the mysql root password, please record it, or you can use ./mysqld --initialize--insecure to initialize an account with an empty password) cd /usr/local/mysql/bin ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data ... 2019-04-11T14:34:15.922856Z 1 [Note] A temporary password is generated for root@localhost: /rTmud(Th5Yy 2. Open port 3306 on the firewall The method of adding ports in Firewalld is as follows: firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd --reload Summarize The above is the tutorial on how to install MySQL under CentOS 7 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: js converts a multidimensional array into a one-dimensional array and then reorders it
>>: Detailed explanation of whereis example to find a specific program in Linux
Table of contents 1. The origin of tomcat 1. Tomc...
Due to business needs, there are often rush purch...
The traditional method is to write a square in a ...
Table of contents 1. Retrieve the image 2. Create...
Add table fields alter table table1 add transacto...
Preface As we all know, bash (the B ourne-A gain ...
When joining a Windows 2008 server subdomain to a...
Query Cache 1. Query Cache Operation Principle Be...
Preface I have installed MySQL 5.6 before. Three ...
Table of contents Overview Application scenarios ...
Table of contents Preface Preliminary preparation...
Preface In terms of layout, Gobang is much simple...
Table of contents 1. Declare and initialize array...
If you have experience in vue2 project developmen...
First: Start and stop the mysql service net stop ...