How to install mysql6 initialization installation password under centos7

How to install mysql6 initialization installation password under centos7

1. Stop the database server first

service mysqld stop

2.vim /etc/my.cnf

3. Add skip-grant-tables to the configuration file

[root@VM_0_8_centos ~]# vim /etc/my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables here! ! ! ! ! !
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

4. Restart the database

systemctl restart mysql

5. Log in to the database

mysql -uroot -p

If asked for a password, log in with an empty password

6.set password for root@localhost = password('123456'); You can change the password in the brackets yourself.

7.mysql -uroot -p123456 login successful

PS: Let's take a look at the Mysql initialization root password and allow remote access

The default mysql root user has no password. Enter mysql –u root to enter mysql.

1. Initialize the root password

Enter the mysql database

mysql>update user set password=PASSWORD('123456') where User='root';

2. To allow remote access to MySQL, you can use the following three methods:

a. Modify the table.

mysql -u root –p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;

b. Authorization.

For example, you want to connect to the mysql server as root using 123456 from any host.

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

If you want to allow user jack to connect to mysql server from host with ip 10.10.50.127 and use 654321 as password

mysql>GRANT ALL PRIVILEGES ON *.* TO 'jack'@'10.10.50.127' IDENTIFIED BY '654321' WITH GRANT OPTION;
mysql> FLUSH RIVILEGES

c: Run on the machine where mysql is installed:

//Enter the MySQL server d:\mysql\bin\>mysql -h localhost -u root
//Give any host access to data mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION
//Make the changes effectivemysql>FLUSH PRIVILEGES
//Exit the MySQL servermysql>EXIT

Summarize

This is the end of this article about how to initialize the installation password of MySQL6 under CentOS7. For more information about how to initialize the installation password of MySQL6 under CentOS7, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Steps to initialize the password after the first successful installation of MySQL
  • MySQL initialization password operation under Mac
  • How to reset the root password in mysql8.0.12
  • Summary of how to modify the root password in MySQL 5.7 and MySQL 8.0
  • mysql settings to change the root password, mysql server connection, mysql common commands diagram
  • Detailed explanation of the idea of ​​installing mysql8.0.11 and changing the root password and connecting navicat for mysql

<<:  Example of troubleshooting method to solve Nginx port conflict

>>:  Native js custom right-click menu

Recommend

JavaScript history object explained

Table of contents 1. Route navigation 2. History ...

Loading animation implemented with CSS3

Achieve results Implementation Code <h1>123...

JS object copying (deep copy and shallow copy)

Table of contents 1. Shallow copy 1. Object.assig...

Implementation of Grid common layout

No gaps on both sides, gaps between each column w...

Detailed explanation of nodejs built-in modules

Table of contents Overview 1. Path module 2. Unti...

When is it appropriate to use dl, dt, and dd?

dl:Definition list Definition List dt:Definition t...

How to implement logic reuse with Vue3 composition API

Composition API implements logic reuse steps: Ext...

Detailed explanation of single-row function code of date type in MySQL

Date-type single-row functions in MySQL: CURDATE(...

Vue and react in detail

Table of contents 1. Panorama II. Background 1. R...

vue-element-admin global loading waiting

Recent requirements: Global loading, all interfac...

Web Design Principles of Hyperlinks

<br />Related articles: 9 practical tips for...

HTML sample code for implementing tab switching

Tab switching is also a common technology in proj...