Home > database >  Linux install mysql5.7 version of the database all the processes and problems
Linux install mysql5.7 version of the database all the processes and problems

Time:09-21

Mysql installation tutorial

Step 1:
(1) the unloading own mysql:
/root @ master ~ # RPM - qa | grep -i mysql
Qt - mysql - 4.6.2-28. El6_5. X86_64
Mysql - 5.1.73-8. El6_8. X86_64
Mysql - libs - 5.1.73-8. El6_8. X86_64
The mysql server - 5.1.73-8. El6_8. X86_64
Perl - DBD - MySQL 4.013-3. El6. X86_64
Input (input respectively, what is your original list of unload what) :
RPM - ev qt - mysql - 4.6.2-28. El6_5. X86_64 -- -- nodeps
RPM - ev mysql - 5.1.73-8 el6_8. X86_64 -- -- nodeps
RPM - ev mysql - libs - 5.1.73-8 el6_8. X86_64 -- -- nodeps
Mysql server - RPM - ev 5.1.73-8 el6_8. X86_64 -- -- nodeps
RPM - ev perl - DBD - MySQL 4.013-3. El6. X86_64 -- -- nodeps
The RPM - qa | grep -i mysql
(2) to delete the original configuration file:
Rm - rf/var/lib/mysqlrm - rf/var/lib/mysqlrm - rf/usr/lib64/mysql
Rm - rf/etc/my. CNF
The RPM - qa | grep -i mysql
Step 2: then proceed to install your own download good mysql5.7 version,
1. Download the browser:
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
The binary installation package, prepare,
2. Create a MySQL system user
Use the following command to create MySQL users of the system:
Groupadd mysql
Useradd - r - g mysql mysql
3. The use of tools to Linux/usr/local/note that the tutorial is installed in/usr/local/path
Unzip into CD/usr/local/
Tar ZXF mysql - 5.7.17 - Linux - glibc2.5 - x86_64. Tar. Gz - C/usr/local/
Rename:
Mv/usr/local/mysql - 5.7.17 - Linux - glibc2.5 - x86_64//usr/local/mysql/
4. Create a data directory
The mkdir/usr/local/mysql/data
5. Switch to the/usr/loca/mysql directory
CD/usr/local/mysql
6. Modify the owner of the current directory for the mysql user
Chown -r mysql: mysql/
Can be run installation database: choose one statement
(1) bin/mysqld - the initialize - user=mysql - basedir=/usr/local/mysql - datadir=/usr/local/mysql/data
(2)/usr/local/mysql/bin/mysqld - user mysql - basedir/usr/local/mysql - datadir/usr/local/mysql/data - the initialize
This time will appear at the end of the root @ localhost: d) (eu; P: the X3 * v temporary password, remember, you have to remember that can be replicated in notepad, in case you forget
# 8. Execute the following command to create the RSA private key note:
(this step, you can not run, don't need to generate the private key, in order to install safety enterprises need such a step, when we single-machine environment installation can not run this command)
Bin/mysql_ssl_rsa_setup - datadir=/usr/local/mysql/data

9. The owner changes the current directory to the root
Chown -r root: a root/
10. Modify the current has for mysql data directory
Chown -r mysql: mysql/data
11. Modify my. CNF and startup
CD support - files
Cp my - default. CNF/etc/my CNF
Cp. Mysql server/etc/init. D/mysql
12. Change
Vim/etc/init. D/mysql
Modify the basedir=/usr/local/mysql (their way)
Modify the datadir=/usr/local/mysql/data (their way)
12. Change my. CNF
Vim/etc/my CNF (all content as below red part, don't ask why @ @)

[client]
Port=3306
Socket=/var/lib/mysql/mysql. The sock
[mysqld]
Character_set_server=utf8
User=mysql
Port=3306
Datadir=/usr/local/mysql/data
Basedir=/usr/local/mysql
Socket=/var/lib/mysql/mysql. The sock
# add_one:
The bind - address=0.0.0.0
Sql_mode=NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES

13. Create the directory:
The mkdir -p/var/lib/mysql/
Chown -r mysql: mysql/var/lib/mysql
14. The configuration database environment variables:
Vi/etc/profile

The export PATH=$PATH: $JAVA_HOME/bin: $HADOOP_HOME/sbin: $HADOOP_HOME/bin: $PATH:/usr/local/mysql/bin

The source/etc/profile
Add: :/usr/local/mysql/bin (the red part of the code is added to the path)
15. Start the database process

Service mysql start
If an error,,,,,,,,, mater. Pid such mistakes, direct input: kill 9 3306
Again can kill 3306 port, you,

According to install OK, when the installation is complete
16. The initial password, do you remember?
This time is the first time login,
Do a soft link, put the mysql installation directory/usr/bin directory
Ln -s/usr/local/mysql/bin/mysql/usr/bin
Input: mysql -u root -p 'initial password (enter) does it have to be like this' input, otherwise an error, I am for this right into the database,
For example:
[root @ master support - files] # mysql -u root -p 'd) (eu; P: the X3 * v '
Enter the initial password: d) (eu; P: the X3 * v
Log in successfully,
Initial password: (note: if you don't remember after practice, under the general basic not do operation, finally return to the first step, it is a little faster, you can have a try, one thousand, ha, ha, ha)
modify/etc/my CNF, add a line under the [mysqld] section: skip - grant - tables=1
This line configuration for mysqld start wrong password validate
Restart the mysqld service: the service restart mysql
, using the root user login to mysql: mysql -u root
, switch to the mysql database, update user table: the update user set authentication_string=password (" root "), password_expired='N', password_last_changed=now () where the user='root';
This password is changed to "root"
In previous versions, the field name is password password field, version 5.7 change to authentication_string
Exit the mysql, edit the/etc/my CNF file, delete the content of the skip - grant - tables=1
Restart the mysqld services, with the new password login again can

Enter the initial password if the success of landing, then the next operation
Change password: the ALTER USER 'root' @ 'localhost' IDENTIFIED BY '123456'.
After the modification,
Input:
show databases;
See if there is a database in the original data,
Such basic database configured,
Mysql> The use of mysql;
16. Open the remote
The code is as follows:
Mysql> GRANT ALL PRIVILEGES ON *. * TO 'itoffice' @ '%' IDENTIFIED BY 'itoffice WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 SEC)

Mysql> flush privileges;
Query OK, 0 rows affected (0.00 SEC)

Mysql> SELECT DISTINCT CONCAT (' User: ' ' ', the User, ' ' '@' ' ', the host, "'; ') AS the query FROM mysql. The user;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related