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

Two ways to introduce svg icons in Vue

How to introduce svg icons in Vue Method 1 of int...

jQuery implements accordion effects

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

How to solve nginx 503 Service Temporarily Unavailable

Recently, after refreshing the website, 503 Servi...

Mysql Chinese sorting rules description

When using MySQL, we often sort and query a field...

About VSCode formatting JS automatically adding or removing semicolons

introduction It is okay to add or not add a semic...

CSS to achieve scrolling image bar example code

On some websites, you can often see some pictures...

Docker data storage tmpfs mounts detailed explanation

Before reading this article, I hope you have a ba...

Teach you how to install mysql database on Mac

Download MySQL for Mac: https://downloads.mysql.c...

base target="" controls the link's target open frame

<base target=_blank> changes the target fram...

MySQL5.7.27-winx64 version win10 download and installation tutorial diagram

MySQL 5.7 installation We are learning MySQL data...

JavaScript article will show you how to play with web forms

1. Introduction Earlier we introduced the rapid d...

Introduction to MySQL role functions

Table of contents Preface: 1. Introduction to rol...