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

How to match the size of text in web design: small text, big experience

With the rise of mobile terminals such as iPad, p...

Three BOM objects in JavaScript

Table of contents 1. Location Object 1. URL 2. Pr...

Tutorial on configuring and using i3 window manager in Linux

In this article, I will show you how to install a...

Solution to the conflict between Linux kernel and SVN versions

Phenomenon The system could compile the Linux sys...

Using Apache ab to perform http performance testing

Mac comes with Apache environment Open Terminal a...

Detailed explanation of object literals in JS

Table of contents Preface 1. Set the prototype on...

Detailed steps to install MySQL on CentOS 7

In CentOS7, when we install MySQL, MariaDB will b...

How to use Vue3 to achieve a magnifying glass effect example

Table of contents Preface 1. The significance of ...

Mini Program Development to Implement Unified Management of Access_Token

Table of contents TOKEN Timer Refresher 2. Intern...

Causes and solutions for MySQL deadlock

The database, like the operating system, is a sha...

In-depth analysis of MySQL execution plans

Preface In the previous interview process, when a...

Using radial gradient in CSS to achieve card effect

A few days ago, a colleague received a points mal...

Echarts legend component properties and source code

The legend component is a commonly used component...

This article will show you the principle of MySQL master-slave synchronization

Table of contents Brief Analysis of MySQL Master-...