MySQL 5.7.17 installation and configuration tutorial under CentOS6.9

MySQL 5.7.17 installation and configuration tutorial under CentOS6.9

CentOS6.9 installs Mysql5.7 for your reference, the details are as follows

1. Upload the installation package

2. Create users and mysql directories

1. Create a mysql group

Enter the command: groupadd mysql

2. Create a mysql user and put it in the mysql group

Enter the command: useradd -r -g mysql mysql

3. Set a password for the mysql user

Enter the command: passwd mysql

3. Unzip Mysql

1. Copy the tarball to the /usr/local/mysql directory

2. Decompression

tar -zxvf mysql.tar

3. Rename the unzipped file to mysql

4. Configure related startup files

1. Copy my_default.cnf to /etc/my.cnf (automatically read when mysql starts)

Back up my.cnf

Copy my.cnf

2. Solve the garbled problem

Enter the command: vi /etc/my.cnf

Change:

[mysql]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character_set_server=utf8

3. Copy mysql.server to /etc/init.d/

4. Modify the /etc/init.d/mysql parameters to give two directory locations

Enter the command: vim /etc/init.d/mysql

Change: basedir=/usr/local/mysql

datadir=/usr/local/mysql/data

5. Change the owner of the directory /usr/local/mysql

Enter the command: chown -R mysql:mysql /usr/local/mysql/

5. Initialize the database

Old command ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/

New command: ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

6. Start the database

Enter the command: ./mysqld_safe --user=mysql &

& symbol: throw the current process to the background

7. Change Password

View the password automatically generated by initialization: cat /root/.mysql_secret

Enter mysql: bin/mysql -uroot -p (paste the password you just copied)

Reset root password after logging in

mysql> SET PASSWORD FOR 'root'@localhost = PASSWORD('123456');

8. Connecting to the virtual machine database on this machine

Check whether only root localhost permissions are authorized. If so, remote access cannot connect

mysql> select Host, User, Password from mysql.user;

Grant % permissions to root

mysql> update user set host = '%' where host = 'localhost';

mysql> flush privileges;

Finish!

IX. Problem

1. ./mysqld_safe: line 586: /var/lib/mysql/mysqld_safe.pid: No such file or directory

Solution:

(1) Because there is no error log during the investigation, we temporarily use the method of supplementing the directory

mkdir -p /var/lib/mysql

chown mysql:mysql /var/lib/mysql

(2) After adding the directory, the error message Can't open and lock privilege tables: Table 'mysql.user' doesn't exist appears

Error in datadir path in My.ini Change path

2.mysqld_safe mysqld from pid file /usr/local/mysql/localhost.pid ended

Query log: Found: The error means mysqld does not have the access rights to the directory.

Change permissions: chmod -R 777

A new problem occurred: Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

Solution: Reinitialize using the old command

3. Starting MySQL..... ERROR! The server quit without updating PID file (/usr/local/mysql/centos6.9.wzy.com.pid).

Problem: character_set_server=utf8 is written incorrectly in my.ini

When I fixed the problem before, my.ini was changed incorrectly datadir=/usr/local/mysql/data

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:
  • MySQL 5.7 installation and configuration tutorial under CentOS7 64 bit
  • Detailed steps to install MySQL on CentOS 7
  • A concise tutorial on how to install mysql5.7 decompressed version on CentOS7
  • Centos7 installation and configuration of Mysql5.7
  • Detailed tutorial on installing Mysql5.7.19 on Centos7 under Linux
  • How to install mysql5.6 on centos7
  • Centos7 install mysql5.6.29 shell script
  • How to install MySQL on CentOS 7 and set it to start automatically
  • The process of installing MySQL 8.0.26 on CentOS7

<<:  jQuery plugin to implement stacked menu

>>:  Summary of methods to check whether the port is open in Linux

Recommend

Browser compatibility summary of common CSS properties (recommended)

Why do we need to summarize the browser compatibi...

How to pull the docker image to view the version

To view the version and tag of the image, you nee...

Mysql method to copy a column of data in one table to a column in another table

mysql copy one table column to another table Some...

18 sets of exquisite Apple-style free icon materials to share

Apple Mug Icons and Extras HD StorageBox – add on...

N ways to align the last row of lists in CSS flex layout to the left (summary)

I would like to quote an article by Zhang Xinxu a...

Media query combined with rem layout in CSS3 to adapt to mobile screens

CSS3 syntax: (1rem = 100px for a 750px design) @m...

Nexus uses nginx proxy to support HTTPS protocol

background All company websites need to support t...

MySQL 8.0.11 Installation Guide for Mac

MAC installs mysql8.0, the specific contents are ...

Detailed explanation of the use of Vue3 state management

Table of contents background Provide / Inject Ext...

Detailed explanation of Mysql transaction isolation level read commit

View MySQL transaction isolation level mysql> ...

MySQL Series 8 MySQL Server Variables

Tutorial Series MySQL series: Basic concepts of M...

MySQL Best Practices: Basic Types of Partition Tables

Overview of MySQL Partitioned Tables As MySQL bec...