Installation and configuration under Linux Centos6.10, 32-bit version mysql5.7.24

You can choose yum installation and download rpm package installation, the latter is introduced here.

1. Download

First go to the official website to download the rpm package  https://dev.mysql.com/downloads/mysql/

I want to download the old version, so I want to choose Looking for previus GA versions?

For installation, I need at least these four installation packages, all of which must be downloaded.

Put them one by one under the shell:

rpm -Uvh mysql-community-client-5.7.24-1.el6.i686.rpm

rpm -Uvh mysql-community-libs-5.7.24-1.el6.i686.rpm

rpm -Uvh mysql-community-client-5.7.24-1.el6.i686.rpm

rpm -Uvh mysql-community-server-5.7.24-1.el6.i686.rpm

After the progress bar is over, the installation is complete.

2. Start configuration mysql

This statement is used to start mysql. If you restart linux, you can run it without executing this command. I don't want to restart here:

service mysqld start

Results after execution:

The next step is to log in to the system, first obtain the initial root password

grep 'temporary password' /var/log/mysqld.log

After the execution, the red box is the password, and then use it to log in.

Enter: mysql -uroot -p

The initial password must be modified, otherwise no other operations can be performed. This assumes that the new password is "MyNewPass4!" Execute:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

You can use the new password for the next login. 

3. Modify the character encoding

In general, I use UTF-8 encoding for development, and the database is the same. However, after mysql is installed, the default is not this encoding, so you need to adjust it.

First look at the character encoding

show variables like '%character%';

Now the database and service code are latin1, here we need to change the mysql configuration file to make them all utf-8.

vi /etc/my.cnf

Add one under [mysqld]

character-set-server=utf8

Press esc and enter: q to save. Then restart the mysql service.

service mysqld restart

Look at the encoding matters again and find that they are all utf8, finished.

 

other:

[Err] 1153-Got a packet bigger than 'max_allowed_packet' bytes appears when importing data files. Check the default size is 4M, here you need to change the size, otherwise the data will not be imported.

show variables like 'max_allowed_packet';

I still have to change my.cnf

Add one under [mysqld]

max_allowed_packet = 100M

Then restart the service and it will take effect.

More questions can refer to this article .

Published 18 original articles · won praise 5 · Views 3487

Guess you like

Origin blog.csdn.net/didixp/article/details/84101092