In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article "method of installing multiple mysql5.7.19 under linux" is not quite understood by most people except programmers. Today, in order to make you better understand the "method of installing multiple mysql5.7.19 under linux", Xiaobian summed up the following contents, which have a certain reference value. The detailed steps are clear and the details are handled properly. I hope you can get something through this article. Next let's take a look at the specific content.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
Environment: centos 6.5
1-download
2-Skip landing
3-1 to install multiple databases, you need to configure your own my.cnf. If only one is installed, the system has not installed this command directly.
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 if there is a data directory. If not, add a command (mkdir data) shell > chmod 750mysql-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
Once installed, you can jump directly to step 5 of the login.
Here's how to install multiple mysql:
3-2 installation of multiple databases requires the following command:
1-add the configuration file my.cnf (command touch my.cnf in the mysql directory):
The following configuration file can be copied directly using paste
Then 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 = 1 the socket is best specified If not specified, the default socket file is used by default and I will have the following problem when logging in to the database: 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-execute the following command
2-1 add user groups. Both my users and groups use mysqlosf at will.
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 to see if there is a data directory. If not, add a command (mkdir data)
2-3 authorize the current directory:
Shell > chmod 750mysql-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.933684Z 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: 1d702294-701e-11e7-98a1-00163e30bbf6.
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 for initializing password)
2-5 establish 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 background 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 in to mysql to change the password and use the temporary password just now.
There's something wrong with me again. Haha, I can't log in all the time.
Access denied for user 'root'@'localhost' (using password:YES) solution is at the bottom
If you log in, you can log in directly using the temporary password and set the password.
5-after logging in to MySQL, you are required to change your password immediately, otherwise nothing can be done. Execute the following command to change the password for 'root'@'localhost':
SET PASSWORD = PASSWORD ('root'); ALTER USER' root'@'localhost' PASSWORD EXPIRE NEVER; flush privileges
6-to log in remotely, add a 'root'@'%' account:
Grant all privileges on *. * to 'root'@'%' identified by' root' with grant option
7-locally test connection
According to the above method, continue to extract and install mysql-5.7.19-linux-glibc2.5-x86_64.tar.gz, and configure port 3308maire3309, you can install multiple mysql.
The solution is installed and cannot be logged in:
If it's like me above.
The reason is that the English in the red box below is that the second mysql needs to specify socket and port, which means that if you do not specify socket, then you will choose the default because we install multiple mysql, so this must be specified.
Mysql-socket=/tmp/mysql3307.sock-port=3307-uroot-p
If the password is accidentally lost here or the password expires, you can reset the password in this way:
5-reset password:
5-1 shutdown process
Kill `cat / usr/local/mysql-5.7.19-3307/data/mysql-5.7.19-3307.pid`
5-2 create file mysql-init
Contents of 5-2-1 file
The first kind of content:
ALTER USER 'root'@'localhost' IDENTIFIED BY' mysqlosf'
Start after saving the content
The copy 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 above content is not successful in selecting 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
The copy 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 &
Thank you for your reading, I hope you have a certain understanding of the key issue of "multiple mysql5.7.19 installation methods under linux", and the specific usage needs to be understood by everyone through hands-on experiments. Try it quickly. If you want to read more articles about related knowledge points, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 232
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.