Install Multiple mysql5.7.19(tar.gz.pdf, mysql5.7.19tar.gz

Source: Internet
Author: User

Install Multiple mysql5.7.19(tar.gz.pdf, mysql5.7.19tar.gz

For the first time in Linux to install the MySQL-5.7.19 version tutorial please refer to the previous article, if you have installed, then please see this linux to Install Multiple mysql-5.7.19

Environment: centos 6.5

1-Download

 

2-Skip Logon

 

3-1 to install multiple databases, You need to configure your own my. cnf. If you only install one database, you can directly run this command without installing it.

Shell> groupadd mysqlshell> useradd-r-g mysql-s/bin/false mysqlshell> cd/usr/localshell> tar zxvf/path/to/mysql-VERSION-OS.tar.gzshell> ln-s full-path -to-mysql-VERSION-OS mysqlshell> cd mysqlshell> mkdir mysql-files: Check whether there is any data directory. If not, add a command (mkdir data) shell> chmod 750 mysql-filesshell> chown-R mysql. shell> chgrp-R mysql. shell> bin/mysql_install_db -- user = mysql # MySQL 5.7.5shell> bin/mysqld -- initialize -- user = mysql # MySQL 5.7.6 and upshell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and upshell> chown-R root. shell> chown-R mysql data mysql-filesshell> bin/mysqld_safe -- user = mysql & # Next command is optionalshell> cp support-files/mysql. server/etc/init. d/mysql. server

After installation, you can directly jump to Step 5.

The following describes how to install multiple mysql instances:

3-2 install the following command to install multiple databases:

1-Add the configuration file my. cnf (run the touch my. cnf command in the mysql directory ):

The following configuration file can be copied directly using paste.

Create the log file/xcxyz/log/mysql/error. log

[Mysqld] basedir =/usr/local/mysql-5.7.19-3307datadir =/usr/local/mysql-5.7.19-3307/dataport = 3307character-set-server = utf8server_id = 11 # It is best to specify this socket, if this parameter is not specified, the default socket file is used by default. When you log on to the database, the following problem occurs: socket =/tmp/mysql3307.sock log-error =/xcxyz/log/mysql/error.. logpid-file =/usr/local/mysql-5.7.19-3307/data/mysql-5.7.19-3307.pid

2-run the following command:

2-1 Add a user group. My users and groups use mysqlosf.

shell> groupadd mysqlshell> useradd -r -g mysql -s /bin/false mysqlshell> cd /usr/localshell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

2-2 establish a soft connection:

shell> ln -s full-path-to-mysql-VERSION-OS mysqlshell> cd mysqlshell> mkdir mysql-files

Check whether there is any data directory. If not, add a command (mkdir data)

2-3 authorize the current directory:

shell> chmod 750 mysql-filesshell> chown -R mysqlosf .shell> chgrp -R mysqlosf .

2-4 Compilation

Bin/mysqld -- defaults-file =/usr/local/full-path-to-mysql-VERSION-OS/my. cnf -- initialize -- user = mysqlosf

View log output: vi/xcxyz/log/mysql/error. log
2017-07-24T03: 13: 47.9320.4z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for more details ).
2017-07-24T03: 13: 49.979892Z 0 [Warning] InnoDB: New log files created, LSN = 45790
2017-07-24T03: 13: 50.262941Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-07-24T03: 13: 50.330756Z 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: login.
2017-07-24T03: 13: 50.340474Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql. gtid_executed' cannot be opened.
2017-07-24T03: 13: 50.344419Z 1 [Note] A temporary password is generated for root @ localhost: jZpgHhigx5> I (especially important to initialize the password later)

2-5 create a key

shell> bin/mysql_ssl_rsa_setup --defaults-file=/usr/local/mysql-5.7.19-3307/my.cnf   

 

2-6 re-Authorization allocation

shell> chown -R root .shell> chown -R mysql data mysql-files

2-7 start mysql

bin/mysqld_safe --defaults-file=/usr/local/full-path-to-mysql-VERSION-OS/my.cnf  --user=mysqlosf &

Next command is optional

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

2-8 check whether mysql starts ps-ef | grep mysql

4. log onto mysql to change the password and use the temporary password.

 

I have another problem here. Haha, I cannot log in at all times.

Access denied for user 'root' @ 'localhost' (using password: YES) solution bottom

If you log on, you can use the temporary password you just logged on and set the password.

5-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;

6-to allow remote logon, add a 'root' @ '%' account:

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

7-local test connection

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

After the solution is installed, login fails:
If it is the same as above
The reason is as follows: in English, the second mysql needs to specify the socket and port, if you do not specify a socket, the default value will be selected. Because we have installed Multiple mysql instances, this parameter must be specified.

mysql --socket=/tmp/mysql3307.sock --port=3307 -uroot -p

If you accidentally lose the password or the password expires, You can reset the password in this way:

 

5-reset the password:

5-1 close the process

kill `cat /usr/local/mysql-5.7.19-3307/data/mysql-5.7.19-3307.pid`

5-2 create the mysql-init file

 

5-2-1 File Content

Content 1:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysqlosf';

 

Start after saving the content

Copy codeThe Code is as follows: bin/mysqld_safe -- defaults-file =/usr/local/mysql-5.7.19-3307/my. cnf -- init-file =/usr/local/mysql-5.7.19-3307/mysql-init -- user = mysqlosf &
If the preceding content fails, select the second content.

UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N' WHERE User = 'root' AND Host = 'localhost';FLUSH PRIVILEGES;

 

Start after saving the content

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

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.