Install MySQL5.6 and rpmmysql5.6 in RedHat Linux RPM
In this installation environment, run the shell command to install the package. The download package is as follows:
MySQL-5.6.25-1.linux_glibc2.5.i386.rpm-bundle.tar;
A. Check MySQL and related RPM packages for installation. If any, remove (rpm-e name)
1 |
[root@localhost ~] # rpm -qa | grep -i mysql |
2 |
mysql-libs-5.1.66-2.el6_3.x86_64 |
3 |
[root@localhost ~] # yum -y remove mysql-libs* |
B. Download the RPM package for Linux as follows:
1 |
[root@localhost rpm] # ll |
3 |
-rw-r--r--. 1 root root 18442536 Dec 11 20:19 MySQL-client-5.6.15-1.el6.x86_64.rpm |
4 |
-rw-r--r--. 1 root root 3340660 Dec 11 20:06 MySQL-devel-5.6.15-1.el6.x86_64.rpm |
5 |
-rw-r--r--. 1 root root 54360600 Dec 11 20:03 MySQL-server-5.6.15-1.el6.x86_64.rpm |
C. Install MySQL
1 |
[root@localhost rpm] # rpm -ivh MySQL-server-5.6.15-1.el6.x86_64.rpm |
2 |
[root@localhost rpm] # rpm -ivh MySQL-devel-5.6.15-1.el6.x86_64.rpm |
3 |
[root@localhost rpm] # rpm -ivh MySQL-client-5.6.15-1.el6.x86_64.rpm |
4 |
# Modifying the configuration file location |
5 |
[root@localhost rpm] # cp /usr/share/mysql/my-default.cnf /etc/my.cnf |
D. initialize MySQL and set the password
1 |
[root@localhost rpm] # /usr/bin/mysql_install_db |
2 |
[root@localhost rpm] # service mysql start |
3 |
[root@localhost rpm] # Cat/root/. mysql_secret # view the root account password |
4 |
# The random password set for the root user at Wed Dec 11 23:32:50 2013 (local time): qKTaFZnl |
5 |
[root@localhost ~] # mysql -uroot –pqKTaFZnl |
6 |
mysql> SET PASSWORD = PASSWORD( '123456' ); # Set the password to 123456 |
8 |
[root@localhost ~] # mysql -uroot -p123456 |
E. Remote login user settings
02 |
mysql> select host,user,password from user; |
03 |
+-----------------------+------+-------------------------------------------+ |
04 |
| host | user | password | |
05 |
+-----------------------+------+-------------------------------------------+ |
06 |
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | |
07 |
| localhost.localdomain | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 | |
08 |
| 127.0.0.1 | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 | |
09 |
| ::1 | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 | |
10 |
+-----------------------+------+-------------------------------------------+ |
12 |
mysql> update user set password=password( '123456' ) where user= 'root' ; |
13 |
mysql> update user set host= '%' where user= 'root' and host= 'localhost' ; |
14 |
mysql> flush privileges; |
F. Set auto-start upon startup
1 |
[root@localhost ~] # chkconfig mysql on |
2 |
[root@localhost ~] # chkconfig --list | grep mysql |
3 |
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
G. default installation location of MySQL
1 |
/var/lib/mysql/ # Database directory |
2 |
/usr/share/mysql # Configuration file directory |
3 |
/usr/bin # Related command Directories |
4 |
/etc/init.d/mysql # Startup Script |
H. Modify Character Set and data storage path
Configure the/etc/my. cnf file, modify the data storage path, mysql. sock path, and default encoding UTF-8.
[Html]View plaincopy
- [Client]
- Password = 123456
- Port = 3306
- Default-character-set = utf8
- [Mysqld]
- Port = 3306
- Character_set_server = utf8
- Character_set_client = utf8
- Collation-server = utf8_general_ci
- # (Note that mysql is installed in linux by default: The table name is case sensitive, and the column name is case insensitive; 0: Case Sensitive, 1: Case Insensitive)
- Lower_case_table_names = 1
- # (Set the maximum number of connections. The default value is 151. the maximum number of connections allowed by the MySQL server is 16384 ;)
- Max_connections = 1000
- [Mysql]
- Default-character-set = utf8
Display character sets
show variables like '%collation%';show variables like '%char%';
I. to remotely connect to mysql, You Need To: authorize and disable the firewall.
1. Authorize; enter mysql on the server and enter the following command
[Grant all privileges on *. * TO 'root' @ '%' identified by 'Here is your password' with grant option;]
OR
[GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION;],
The difference is whether a password is required during access.
The purpose of this statement is to set all user names to remotely access all the tables in mysql. If you do not want to release them, you can set them according to this rule. grant permission 1, permission 2 ,... Permission n on database name. Table name to user name @ user address identified by 'Password '.
2. Disable the Firewall
Service iptables stop command chkconfig iptables off permanent firewall Shutdown
Run the two commands at the same time. After running, check the firewall shutdown status.
service iptables status
At this point, mysql is installed and configured successfully.