Install MySQL5.6 in RPM mode in CentOS, centosmysql5.6

Source: Internet
Author: User

Install MySQL5.6 in RPM mode in CentOS, centosmysql5.6

All previous projects were deployed in the windows system environment. This time, we tried to deploy them in the Linux system environment, so this time, we have installed JDK, Maven, and Jboss on seven hosts, one of which has installed Mysql, and configured the lan. Finally, we are done. The installation steps are as follows!

System Version:Centos6.3-i386 32-bit Operating System
Hardware configuration:Kernel Intel (R) Pentium (R) 4 CPU 3.00 GHz memory 998.5 M
Installation environment:Use shell commands

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)

[root@localhost ~]# rpm -qa | grep -i mysqlmysql-libs-5.1.66-2.el6_3.x86_64[root@localhost ~]# yum -y remove mysql-libs*

B. Select the RPM package for Linux as follows:

[root@localhost rpm]# lltotal 74364-rw-r--r--. 1 root root 18442536 Dec 11 20:19 MySQL-client-5.6.15-1.el6.x86_64.rpm-rw-r--r--. 1 root root 3340660 Dec 11 20:06 MySQL-devel-5.6.15-1.el6.x86_64.rpm-rw-r--r--. 1 root root 54360600 Dec 11 20:03 MySQL-server-5.6.15-1.el6.x86_64.rpm

C. Install MySQL

[Root @ localhost rpm] # rpm-ivh MySQL-server-5.6.15-1.el6.x86_64.rpm [root @ localhost rpm] # rpm-ivh MySQL-devel-5.6.15-1.el6.x86_64.rpm [root @ localhost rpm] # rpm-ivh MySQL-client-5.6.15-1.el6.x86_64.rpm # modify configuration file location [root @ localhost rpm] # cp/usr/share/mysql/my-default.cnf/etc/my. cnf

D. initialize MySQL and set the password

[Root @ localhost rpm] #/usr/bin/mysql_install_db [root @ localhost rpm] # service mysql start [root @ localhost rpm] # cat/root /. mysql_secret # view The root account password # the random password set for The root user at Wed Dec 11 23:32:50 2013 (local time): qKTaFZnl [root @ localhost ~] # Mysql-uroot-pqKTaFZnlmysql> set password = PASSWORD ('000000'); # SET the PASSWORD to 123456 mysql> exit [root @ localhost ~] # Mysql-uroot-p123456

E. Remote login user settings

mysql> use mysql;mysql> select host,user,password from user;+-----------------------+------+-------------------------------------------+| host         | user | password                 |+-----------------------+------+-------------------------------------------+| localhost       | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 || localhost.localdomain | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 || 127.0.0.1       | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 || ::1          | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 |+-----------------------+------+-------------------------------------------+mysql> update user set password=password('123456') where user='root';mysql> update user set host='%' where user='root' and host='localhost';mysql> flush privileges;mysql> exit

F. Set auto-start upon startup

[root@localhost ~]# chkconfig mysql on[root@localhost ~]# chkconfig --list | grep mysqlmysql      0:off  1:off  2:on  3:on  4:on  5:on  6:off

G. default installation location of MySQL

/Var/lib/mysql/# Database directory/usr/share/mysql # configuration file directory/usr/bin # related command directory/etc/init. d/mysql # Start 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.

[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 after completion, it is the default: table names are case-sensitive and column names are 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. authorization;Enter mysql on the server and enter the following command:

Copy codeThe Code is as follows: [grant all privileges on *. * TO 'root' @ '%' identified by 'Here is your password' with grant option;]
OR
Copy codeThe Code is as follows: [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.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.