My installation environment for centos6.4 MySQL-related packages by www.mysql.com
dev.mysql.com Download
Install MySQL in RPM package:
[Email protected] ~]# wget http://dev.mysql.com/get/downloads/mysql-5.6/mysql-5.6.30-1.el6.x86_64.rpm-bundle.tar[ [Email protected] ~]# lsmysql-5.6.30-1.el6.x86_64.rpm-bundle.tar[[email protected] ~]# tar xvf mysql-5.6.30-1.el6.x86_ 64.rpm-bundle.tar-c/usr/src/mysql/[[email protected] ~]# cd/usr/src/mysql/[[email protected] mysql]# RPM-IVH MYSQL-CL ient-5.6.30-1.el6.x86_64.rpm mysql-devel-5.6.30-1.el6.x86_64.rpm mysql-server-5.6.30-1.el6.x86_64.rpm # Use RPM package to pay attention to the dependency relationship error is basically a package dependency problem install the appropriate package to resolve dependencies based on the error message
Install MySQL based on the official Yum Source:
[[email protected] ~]# wget Http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm[[email protected] ~] # Lsmysql57-community-release-el6-8.noarch.rpm[[email protected] ~]# RPM-IVH MYSQL57-COMMUNITY-RELEASE-EL6-8.NOARCH.RPM # automatically configures the Yum source for us [email protected] ~]# Yum install mysql-client my Sql-server # Installing MySQL
You can also build your own MySQL yum source.
How to build Yum source see http://11427860.blog.51cto.com/11417860/1769560
[[email protected] ~]# Vim/etc/yum.repos.d/mysql-community.repo # There are MySQL versions of the source address from the inside copy out of their own build MySQL yum source
To start the MySQL service:
[[email protected] ~]#/etc/init.d/mysql start
Or
[[Email protected] ~]# service MySQL start
To view the MySQL initial password:
[Email protected] ~]# Cat/root/.mysql_secret
MySQL will generate a random initial password at the beginning of the MySQL5.6 version, and the password is in/root/.mysql_secret
Before MySQL5.6 the version is blank password by default, can log in directly
[[email protected] ~]# mysql_secure_installation# after entering the initial password change the root password? [y/n] y # Transmission y Create a new root password ... remove anonymous users? [y/n] y # Transmission y Remove anonymous user # mysql after installation, an anonymous user is installed by default, which is used for testing, allows anyone to log in to MySQL from anywhere, but cannot do anything else, which is a security risk and removes it. ... disallow root login remotely? [y/n] y # The root user is not allowed to log in from a distance to this machine, Generally in the production environment choose y To improve security, if you want to log in to MySQL with the root user, you will often use SSH to log in remotely to that specific MySQL server, and then log in with the root user of MySQL locally on that server. ... remove test database and access to it? [y/n] y # whether to remove test database output y Remove the MySQL installation will create a test library by default, and this library can be accessed by anyone This library is for testing. ... reload privilege tables now? [y/n] y # loss y let's just on MYsql authorization changes are effective immediately ... # And then it's almost logged into MySQL.
Log in to MySQL
[[email protected] ~]# mysql-uroot-p ' password ' mysql> mysql>set passwrd = PASSWORD (' newpasswd '); Set a new password
If you cannot find the initial password or forget the root password, you can reset the root password by doing the following:
Modify the MySQL configuration file (default is/ETC/MY.CNF)
[[email protected] ~]# VIM/ETC/MY.CNF # Add a line under [Mysqld] Skip-grant-tables
Restart MySQL Service
[[Email protected] ~]# service restart MySQL
You can now go directly to MySQL without a password
mysql> Update Mysql.user Set Authentication_string=password (' NewPassword '), where user= ' root ' and host= ' localhost '; # Reset root password mysql> flush privileges;mysql> quit;
Restore/ETC/MY.CNF, restart the MySQL service, log in to MySQL with Mysql-uroot-p ' newpassword '
Installing MySQL with the official RPM pack and Yum is characterized by simple speed, but no custom installation, and a primer.
This article is from the "11417860" blog, please be sure to keep this source http://11427860.blog.51cto.com/11417860/1769843
Rpm/yum installation of MySQL