Tutorial on installing MySQL 5.6 using RPM in CentOS

Tutorial on installing MySQL 5.6 using RPM in CentOS

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 installed JDK, Maven, and Jboss on 7 hosts, installed Mysql on one of them, and configured the LAN. Finally, we completed the task. The installation steps will be shared with you below!

System version: centos6.3-i386 32-bit operating system
Hardware configuration: Core Intel(R) Pentium(R) 4 CPU 3.00GHz Memory 998.5M
Installation environment: Use shell command

This installation is in the desktop environment. Use shell commands to install. The downloaded installation package is:
MySQL-5.6.25-1.linux_glibc2.5.i386.rpm-bundle.tar;
a. Check whether MySQL and related RPM packages are installed. If so, remove them (rpm –e name)

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

b. Select the RPM package corresponding to Linux, as follows:

[root@localhost rpm]# ll
total 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 the configuration file location [root@localhost rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

d. Initialize MySQL and set 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 –pqKTaFZnl
mysql> SET PASSWORD = PASSWORD('123456'); #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 the system to start automatically

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

g. MySQL default installation location

/var/lib/mysql/ #Database directory /usr/share/mysql #Configuration file directory /usr/bin #Related command directory /etc/init.d/mysql #Startup script

h. Modify the character set and data storage path

Configure the /etc/my.cnf file, modify the data storage path, mysql.sock path and the 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 after installing MySQL in Linux, the default is: table names are case-sensitive, column names are not case-sensitive; 0: case-sensitive, 1: case-insensitive) 
lower_case_table_names=1 
#(Set the maximum number of connections, the default is 151, the maximum number of connections allowed by the MySQL server is 16384; ) 
max_connections=1000 
[mysql] 
default-character-set = utf8 

Viewable character set

show variables like '%collation%'; 
show variables like '%char%';

I. If you want to log in to MySQL remotely, you need to: authorize and turn off the firewall.

1. Authorization; enter mysql on the server and enter the following command

Copy the code as follows:
[GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'here is your password' WITH GRANT OPTION;]

OR
Copy the code as follows:
[GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION;]

The difference lies in whether a password is required for access.
This sentence is used to set all user names to be able to remotely access all tables in MySQL. If you don't want to release all, you can set it 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. Turn off the firewall

service iptables stop Shutdown command chkconfig iptables off Permanently shut down the firewall

Run the two commands at the same time. After the execution is complete, check the firewall shutdown status.

service iptables status

At this point, MySQL has been installed and configured successfully.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Install mysql5.7.17 using RPM under Linux
  • Complete steps to install the latest mysql5.7.17 using rpm in Linux system
  • Install mysql5.7.13 using RPM in CentOS 7
  • Record the solution of unable to install mysql-Invalid GPG Key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
  • Detailed explanation of installing MySQL version 5.6 using rpm
  • CentOS7 detailed installation of MySQL using rpm
  • Detailed tutorial on installing mysql5.6.33 using RPM in CentOS6.5
  • Install MySQL 5.6 source code using RPM
  • Tutorial on installing mysql in rpm mode under Linux
  • Completely delete Mysql in Centos (rpm, yum installation)

<<:  Detailed explanation of custom configuration of docker official mysql image

>>:  JavaScript to filter arrays

Recommend

JavaScript realizes the generation and verification of random codes

The generation and verification of random codes i...

Introduction to CSS BEM Naming Standard (Recommended)

1 What is BEM Naming Standard Bem is the abbrevia...

Linux file management command example analysis [display, view, statistics, etc.]

This article describes the Linux file management ...

About the problem of writing plugins for mounting DOM in vue3

Compared with vue2, vue3 has an additional concep...

How to implement Vue timer

This article example shares the specific code of ...

Docker Compose one-click ELK deployment method implementation

Install Filebeat has completely replaced Logstash...

Vue implements internationalization of web page language switching

1. Basic steps 1: Install yarn add vue-i18n Creat...

Implementation of Docker batch container orchestration

Introduction Dockerfile build run is a manual ope...

How to embed flash video format (flv, swf) files in html files

Flash file formats: .FLV and .SWF There are two ex...

How to parse the attribute interface of adding file system in Linux or Android

The first one: 1. Add key header files: #include ...

Web front-end development experience summary

XML files should be encoded in utf-8 as much as p...

HTML unordered list bullet points using images CSS writing

Create an HTML page with an unordered list of at l...

Docker+selenium method to realize automatic health reporting

This article takes the health reporting system of...