Oracle Linux 6.8 detailed tutorials for installing mysql 5.7.17
The method to install MySQL 5.7.17 is as follows:
1. download
Http://www.codeyyy.com/linux/149-150-153.html
two。 Upload and decompress
Tar-xvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
3. Create a new mysql directory
Mkdir-p / usr/local/mysql/datamv mysql-5.7.17-linux-glibc2.5-x86_64/* / usr/local/mysql/
4. Add a user group
Groupadd mysql
5. New user
Useradd-g mysql-d / usr/local/mysql mysql
6. Change mysql directory permissions
Chown-R mysql.mysql / usr/local/mysql/
7. Initialize the database (installed in the MySQL directory)
Because this is version 5.7, it is not applicable (. / bin/mysql_install_db-- user=mysql-- basedir=/usr/local/mysql/-- datadir=/usr/local/mysql/data/)
. / bin/mysqld-user=mysql-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data-initialize
Remember the random password above
Root@localhost: > HLaOQH;U6L3
8. Copying configuration files to / etc/my.cnf is a basic configuration problem for mysql.
Cp-a. / support-files/my-default.cnf / etc/my.cnf # will have a choice of whether or not to overwrite the original file. Just press enter y to select Yes.
And edit vi my.cnf
# These are commonly set, remove the # and set as required.basedir = / usr/local/mysqldatadir = / usr/localmysql/dataport = 330 socket server_id = .socket = / tmp/mysql.sockcharacter-set-server=utf-8
At this time, copying the my.cnf and then starting it will fail (this file will not be copied)
Mysql/support-files/mysql.server restart
9. Put mysql into the local system service
Cp-a. / support-files/mysql.server / etc/init.d/mysqld
10. Configure mysql
# cp / home/mysql/support-files/mysql.server / etc/init.d/mysqld # copy the startup file to / etc/init.d/ and repeat the command to add execution permissions to mysqld# chmod 755 / etc/init.d/mysqld # # chkconfig-- list mysqld# checks that mysqld is not in the list of startup items # chkconfig-- add mysqld # if not, add mysqld:# chkconfig mysqld on # use this command to set boot:
11. Create a soft link
# ln-s / home/mysql/bin/mysql / usr/bin/mysql
Start / restart / stop of the 12.mysql service
# service mysqld start # start service # service mysqld restart # restart service # service mysqld stop # stop service
13. Enter mysql
. / bin/mysqladmin-u root-p or mysql-u root-p
Enter the temporary password to start saving
> HLaOQH;U6L3
14. Modify the password
1)。 Change the password in mysql
Mysql > SET PASSWORD = PASSWORD ('123456')
2) the previous password can be found in the temporary file (not tried)
Find /-name mysql.sock
15. Set Encodin
Show variables like 'character%'; # query encoding SET character_set_database = utf8;-set encoding
2 kinds of 16.mysql remote Authorization (key)
1) mysql > grant all privileges on *. * to 'root'@'%' identified by' 123456) grant all on *. * to 'root'@'%' identified by' 123456'
The above is the detailed tutorial of Oracle Linux 6.8 installation mysql 5.7.17 introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!