MySQL database installation (CentOS operating system/tar.gz method)

(1) Upload the Mysql installation package "mysql-5.6.35-linux-glibc2.5-i686.tar.gz" to the deployment machine at any location;

(2) Unzip the Mysql installation package to its directory, the command is as follows:

tar -zxvf mysql-5.6.35-linux-glibc2.5-i686.tar.gz

(3) Copy the decompressed directory to the local software directory "/usr/local/" of the system, the command is as follows:

cp -rf mysql-5.6.35-linux-glibc2.5-i686  /usr/local/mysql

(4) Add mysql user group and mysql user, the command is as follows:

groupadd mysql

useradd -r -g mysql mysql

(5) Enter the directory where the Mysql software is installed, the command is as follows:

cd /usr/local/mysql

(6) Modify the owner of the current directory to the newly created mysql user, the command is as follows:

chown -R mysql:mysql ./

(7) Copy the default global startup parameter configuration file to the /etc directory, the command is as follows:

cp ./support-files/my-medium.cnf  /etc/my.cnf

(8) Execute the script in the installation package to install the database, the command is as follows:

./scripts/mysql_install_db --user=mysql

(9) Modify the owner of the current directory as root user, the command is as follows:

chown -R root:root ./

(10) Modify the owner of the data directory to the mysql user, the command is as follows:

#chown -R mysql:mysql data

At this point, the database installation is complete, let's verify it.

(11) Modify the /etc/my.cnf file. Modify the character set of the database and make it "case-insensitive" and support large pictures.

Add under [client]:

default-character-set=utf8

Add under [mysqld]:

character-set-server=utf8

max_allowed_packet = 4M

lower_case_table_names=2

Add under [mysql]:

default-character-set=utf8

(12) Start the Mysql database, note: need to be executed with root privileges, the command is as follows:

sudo/usr/local/mysql/support-files/mysql.server start

Check whether the Mysql process has been started, the command is as follows:

ps -ef | grep mysql

The result shown in the figure below is displayed, indicating that the Mysql database has been started successfully:

(13) Modify the password of the root user of the Mysql database. The initial password of root is empty by default. The command is as follows:

./bin/mysqladmin -u root password'Fill in the password here'

Guess you like

Origin blog.csdn.net/lc547913923/article/details/64906180