Installation tutorial of MySQL 5.1 and 5.7 under Linux

Installation tutorial of MySQL 5.1 and 5.7 under Linux

The operating system for the following content is: centos 6.7

yum install mysql 5.1.73

Uninstall the system's own mysql

Execute the following command to check whether there is built-in MySQL:

rpm -qa | grep mysql

If any output is found, execute the following commands to delete them one by one:

rpm -e **** --nodeps

Start installing mysql

First install the mysql client:

yum install mysql

Then install the mysql server:

yum install mysql-server 
yum install mysql-devel

At this point, mysql related components have been installed successfully!

Modify the character set

The mysql configuration file path is:

/etc/my.cnf

Add the following configuration to the configuration file to modify the character set:

default-character-set=utf8

Start and Stop

Execute the following command to start:

service mysqld start

The stop command is:

service mysqld stop

The startup results are as follows:

Add mysql to boot

After adding the startup, you don't need to manually start the MySQL service next time you restart the machine:

chkconfig --level 345 mysqld on

After execution, view the results and execute the command:

chkconfig --list | grep mysql

The results are as follows, which proves that the startup is successful:

Configure the initial password

Execute the following command to set the initial root password:

mysqladmin -u root password yourPassword

Login to mysql

Log in as root and the password set in the previous step and execute:

mysql -u root -p

As follows, the login is successful:

Allow remote login

Execute sql:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpasswd' WITH GRANT OPTION;
FLUSH RIVILEGES;

After the execution is completed, test whether you can log in on localhost and any remote host!

mysql 5.7.19 installation

This version of MySQL requires glibc14 support, but centos 6.7 can only support glic12, so the downloaded version is the officially compiled glibc version, which can be unzipped during installation. The operating system is centos6.7, [Installation package download address]

http://dev.mysql.com/downloads/mysql/)

Uninstall the system's own mysql

Execute the following command to check whether there is built-in MySQL:

rpm -qa | grep mysql

If any output is found, execute the following commands to delete them one by one:

rpm -e **** --nodeps

Unzip mysql

Copy the downloaded MySQL installation package to /opt, unzip the installation package and rename it:

tar zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
# rename mv mysql-5.7.19-linux-glibc2.12-x86_64 mysql

Initialize mysql

Enter /opt/mysql and initialize the database:

./bin/mysqld --user=root --basedir=/opt/mysql --datadir=/opt/mysql/data --initialize

After execution, the following will be output on the console:

[Note] A temporary password is generated for root@localhost: **mjT,#x_5sW
"**mjT,#x_5sW" is the automatically generated initial password!

Create a configuration file

Go to /opt/mysql/support-files

Execute the following command to generate the configuration file:

cp my-default.cnf /etc/my.cnf

Set mysql as a service and start it at boot

Modify the /opt/mysql/support-files/mysql.server file and find:

basedir=/home/mysql
datadir=/home/mysql/data

Modified to:

basedir=/opt/mysql
datadir=/opt/mysql/data

Then copy the command file to the system service directory:

cp /opt/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld

Start and Stop

The start/stop commands for mysql are:

service mysqld start/stop

The above installation is successful

This installation tutorial of MySQL 5.1 and 5.7 under Linux is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed tutorial on installing Mysql5.7.19 on Centos7 under Linux
  • MySQL 5.7.19 (tar.gz) installation graphic tutorial under Linux
  • MySQL 5.6.27 Installation Tutorial under Linux
  • MySQL 8.0 installation tutorial under Linux
  • Detailed steps to install MySql 5.7.21 in Linux
  • How to install and configure the decompressed version of MySQL database under Linux system
  • Detailed tutorial for installing MySQL on Linux
  • MySQL 5.7 installation and configuration tutorial under Linux virtual machine
  • Detailed steps to install MySQL 5.6 X64 version under Linux

<<:  js precise calculation

>>:  Tutorial on processing static resources in Tomcat

Recommend

Analysis and description of network configuration files under Ubuntu system

I encountered a strange network problem today. I ...

MySQL Series 3 Basics

Table of contents Tutorial Series 1. Introduction...

Vue implements page caching function

This article example shares the specific code of ...

Several ways to implement CSS height changing with width ratio

[Solution 1: padding implementation] principle: I...

Nginx 502 Bad Gateway Error Causes and Solutions

I have encountered the Nginx 502 Bad Gateway erro...

A brief analysis of MySQL locks and transactions

MySQL itself was developed based on the file syst...

Solution to IDEA not being able to connect to MySQL port number occupation

I can log in to MYSQL normally under the command ...

How to implement web stress testing through Apache Bench

1. Introduction to Apache Bench ApacheBench is a ...

MySQL fuzzy query statement collection

SQL fuzzy query statement The general fuzzy state...

The functions and differences between disabled and readonly

1: readonly is to lock this control so that it can...

MySQL 8.0.19 installation and configuration method graphic tutorial

This article records the installation and configu...

jQuery achieves full screen scrolling effect

This article example shares the specific code of ...

Three implementation methods of Mysql copy table and grant analysis

How to quickly copy a table First, create a table...

jQuery achieves breathing carousel effect

This article shares the specific code of jQuery t...