Mysql5.7.19(tar.gz.pdf installation tutorial under linux, mysql5.7.19tar.gz

Source: Internet
Author: User

Mysql5.7.19(tar.gz.pdf installation tutorial under linux, mysql5.7.19tar.gz

The first time you install the mysql-5.7.19 version tutorial in linux, if you have installed, then see the next linux install multiple mysql-5.7.19

Environment: centos 6.5

1. Download

 

2. Skip Logon

 

3. Upload and unzip to directory ../usr/local/mysql-5.7.19-3307

Copy codeThe Code is as follows: tar-zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz-C ../usr/local/mysql5.7.19-3307

 

4. Add the mysql group and mysql users:

Run the following command:

Groupadd mysqlosf and useradd-r-g mysqlosf

 

5. Authorize the current directory to the group user mysqlosf

chown -R mysqlosf:mysqlosf .

 

If the two commands in the red box fail to be executed, the error is reported because the path cannot be found. The reason is that the system installs the command to usr/lcoal/mysql by default.

Because one system may install multiple databases, one master, multiple slave, or multiple master, multiple slave, this is also because I have a mysql, so I will not use its default path and port 3306 during installation, and select the custom path usr /, then we find that the new mysql version has problems.

 

So I checked the mysqld execution file, and the result is very sorry, so I saw a mysql under support-files. the server is highlighted in a red box, so we understand that it is the default configuration file, and the description in the red box is as follows:

 

If you install mysql in another path instead of usr/local/mysql, you must do the following to run this script in the directory where mysql is installed and create a/etc/my. cnf file and the following information

[mysqld] basedir=<path-to-mysql-installation-directory> 

Add the preceding content to any other configuration file, such ~ /. My. ini

And copy my_print_defaults to/usr/bin to add this path to the basic path of the installation directory. If you want to affect other variables, you should make some changes in the etc/my. cnf or other configuration information.

If you change the basic directory, you must also change the datadir Data Directory, which will be overwritten by the default configuration file.

But in the same way, I found an awful thing. If you have installed this one, then another mysql is also installed. Do you want to go to etc/my. cnf? We can find that what he wants to express here is that if you only need to install a mysql instance, you can install it as described above, but now we need to install multiple instances, this is definitely not possible, but the configuration file is certainly

6, you need to first create my. cnf configuration file under the mysql-5.7.19-3307 directory, such:

 

7. Start initializing mysql on port 3307:

Copy codeThe Code is as follows: bin/mysqld -- defaults-file =/usr/local/mysql-5.7.19-3307/my. cnf -- initialize -- user = mysqlosf

Then prompt information

2017-07-20T03: 34: 58.140832Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for more details ).
2017-07-20T03: 35: 00.20.126z 0 [Warning] InnoDB: New log files created, LSN = 45790
2017-07-20T03: 35: 00.482183Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-07-20T03: 35: 00.554451Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: Large.
2017-07-20T03: 35: 00.557933Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql. gtid_executed' cannot be opened.
2017-07-20T03: 35: 00.562343Z 1 [Note] A temporary password is generated for root @ localhost:

HgPcBW? Xf86b (temporary Database Password New Version database to enhance security)
------------

 

8. Generate a key:

bin/mysql_ssl_rsa_setup --defaults-file=/usr/local/mysql-5.7.19-3307/my.cnf
Generating a 2048 bit RSA private key........................................................................................+++................................................................+++writing new private key to 'ca-key.pem'-----Generating a 2048 bit RSA private key............................+++....+++writing new private key to 'server-key.pem'-----Generating a 2048 bit RSA private key...........................................................................................+++......................................................................+++writing new private key to 'client-key.pem'-----

 

9. Fill in the previous directory. Haha, I didn't create it before. I don't know what the impact will be.

mkdir mysql-fileschmod 750 mysql-fileschown -R root . chown -R mysqlosf data mysql-files

10. Start mysql background

bin/mysqld_safe --user=mysqlosf &
[1] 28106[root@iZ2ze2jvzepskyobjmavtiZ mysql-5.7.19-3307]# 2017-07-20T04:01:40.623159Z mysqld_safe Logging to '/alidata/log/mysql/error.log'.2017-07-20T04:01:40.679386Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.7.19-3307/data2017-07-20T04:01:40.868828Z mysqld_safe mysqld from pid file /usr/local/mysql-5.7.19-3307/data/iZ2ze2jvzepskyobjmavtiZ.pid ended

 

11. Next command is optional

shell> cp support-files/mysql.server /etc/init.d/mysql.server

12-start logging on to mysql for related operations

bin/mysql -uroot -p

Enter the password as prompted during port Initialization

 

However, the system rejects the SQL statement and finds that there is a problem with msyqld_safe when the preceding SQL statement is started .... Ended

Copy codeThe Code is as follows: mysqld_safe mysqld from pid file/usr/local/mysql-5.7.19-3307/data/iZ2ze2jvzepskyobjmavtiZ. pid ended

 

That is to say, it is not started. Check the following: (it is true that the problem has not been solved)

 

No error is reported when using the root user to log on, but this status is always unsuccessful.

 

Check that the status is started, but the problem is that the two sockets are the same, but they are not a port. You can try again.

 

If it succeeds, it should be the mysqlosf just now. I have no assignment permission... My days

 

13. After logging on to MySQL, you must change the password immediately. Otherwise, you cannot perform any operations. Run the following command to modify the password of 'root' @ 'localhost:

SET PASSWORD = PASSWORD('root'); ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; flush privileges;

14. To allow remote logon, add a 'root' @ '%' account:

grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option; 

15. Local test connection

Install mysql-5.7.19-linux-glibc2.5-x86_64.tar.gz and set it to port 3308, 3309.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.