Linux CentOS 6.5 Uninstall, tar and install MySQL tutorial

Linux CentOS 6.5 Uninstall, tar and install MySQL tutorial

Uninstall the system-provided MySQL

1. Check whether MySQL is currently installed on the system

rpm -qa|grep -i mysql 

2. Uninstall the current version of MySQL

yum remove mysql mysql-server mysql-libs mysql-server

When a selection appears during the uninstallation process, just click "y"

Check again and no information means it has been uninstalled

3. Find the remaining files and delete them

find / -name mysql

4. Create mysql user group/user, data directory and its user directory

userdel mysql # delete user groupdel mysql # delete user group name mkdir /usr/local/mysql # the default installation path of mysql, it is recommended not to change, if you change it, you need to update the configuration later mkdir /usr/local/mysql/data # create a folder data under the mysql folder 
groupadd mysql # Create a user group named mysql useradd -r -g mysql mysql # Create a user under the user group

5. Unzip and transfer MySQL files

# tar -xzvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz # Unzip the file # cd mysql-5.7.17-linux-glibc2.5-x86_64 # Enter # mv * /usr/local/mysql/ # Move the file

6. Enter the mysql directory to change permissions

cd mysql/

chown -R mysql:mysql ./

7. Execute the installation script

./scripts/mysql_install_db --user=mysql 

8. After installation, change the current directory owner to root user and the data directory owner to mysql

chown -R root:root ./
chown -R mysql:mysql data

9. Start MySQL

./support-files/mysql.server start

Startup Success

If MySQL reports an error when starting, it may be that there is already a MySQL process, just kill it

10. Change mysql password

# After MySQL is started, execute the following command to change the password:
./bin/mysqladmin -u root -h localhost.localdomain password 'root'

11. Log in to MySQL

# After changing the password, you can log in to MySQL
./bin/mysql -h127.0.0.1 -uroot -proot

Summarize

The above is the tutorial on how to uninstall and install MySQL in Linux CentOS 6.5. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • CentOS7.x uninstall and install MySQL5.7 operation process and encoding format modification method
  • How to completely uninstall mysql under CentOS
  • Several methods to completely uninstall MySQL under CentOS
  • How to uninstall MySQL 5.7 on CentOS7

<<:  Record the whole process of MySQL master-slave configuration based on Linux

>>:  JavaScript implements Tab bar switching effects

Recommend

Introduction to JavaScript array deduplication and flattening functions

Table of contents 1. Array flattening (also known...

Optimizing query speed of MySQL with tens of millions of data using indexes

1. The role of index Generally speaking, an index...

Detailed explanation of the EXPLAIN command and its usage in MySQL

1. Scenario description: My colleague taught me h...

The visual design path of the website should conform to user habits

Cooper talked about the user's visual path, w...

HTML table tag tutorial (27): cell background image attribute BACKGROUND

We can set a background image for the cell, and w...

In-depth understanding of JavaScript callback functions

Table of contents Preface Quick Review: JavaScrip...

How to set up scheduled tasks in Linux and Windows

Table of contents Linux 1. Basic use of crontab 2...

Practice of el-cascader cascade selector in elementui

Table of contents 1. Effect 2. Main code 1. Effec...

Summary of discussion on nginx cookie validity period

Every visit will generate Cookie in the browser, ...

Sample code for JS album image shaking and enlarging display effect

The previous article introduced how to achieve a ...

Two ways to use react in React html

Basic Use <!DOCTYPE html> <html lang=&qu...

Code analysis of synchronous and asynchronous setState issues in React

React originated as an internal project at Facebo...

A brief discussion on three methods of asynchronous replication in MySQL 8.0

In this experiment, we configure MySQL standard a...

An article to help you understand the basics of VUE

Table of contents What is VUE Core plugins in Vue...

Example of implementing element table row and column dragging

The element ui table does not have a built-in dra...