当前位置:网站首页>Linux Installation MySQL (pit filling version)
Linux Installation MySQL (pit filling version)
2022-07-28 20:21:00 【LifeBackwards】
Before installation , First check whether the system has been installed mysql:
rpm -qa | grep mysql |
If installed , You can choose to uninstall through the following command :
rpm -e mysql // Normal delete mode rpm -e --nodeps mysql // Strong delete mode , If you use the above command to delete , Prompt for other dependent files , It can be forcefully deleted with this command |
install Mysql
Tools :CentOS 7 64 position 、Mysql5.7
1 Download from the official website mysql Compiled binary installation package
choice 64 Bit system download Linux - Generic (glibc 2.5) (x86, 64-bit).

2 Unzip the installation package
Enter the directory where the installation package is located , Unzip the installation package :
tar -zxvf mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz |
3 Copy the decompressed mysql Directory to the local software directory of the system
Be careful : Don't add /
mv mysql-5.7.10-linux-glibc2.5-x86_64 /usr/local/mysql |
4 Add system mysql Group and mysql user
Carry out orders :groupadd mysql and useradd -r -g mysql mysql
![]()
5 mount this database
5.1 Create a data directory and give permissions :
mkdir -p /data/mysql chown mysql:mysql -R /data/mysql |
5.2 To configure my.cnf:
vim /etc/my.cnf |
The contents are as follows :
[mysqld] bind-address=0.0.0.0 port=3306 user=mysql basedir=/usr/local/mysql datadir=/data/mysql socket=/tmp/mysql.sock log-error=/data/mysql/mysql.err pid-file=/data/mysql/mysql.pid #character config character_set_server=utf8mb4 symbolic-links=0 explicit_defaults_for_timestamp=true
|
5.3 Initialize database
Get into mysql Of bin Catalog :cd /usr/local/mysql/bin
initialization
./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql --initialize |
5.4 Boot up mysql service
Put the startup script into the startup initialization directory :
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql |
Give executable permission :chmod +x /etc/init.d/mysql
Add as a service : chkconfig --add mysql
View the list of services : chkconfig --list mysql

notice 3、4、5 The status is on or on That means success . If it is Off or off Then execute :chkconfig --level 345 mysqld on
5.5 start-up
start-up mysql
service mysql start |
ps -ef|grep mysql notice mysql Service description started successfully , Pictured

So let's go over here mysql It has been installed successfully !
5.6 Change Password
The following changes mysql password , Log in first mysql, The initial password is empty , If you cannot log in successfully :
![]()
be , Stop service first :/etc/init.d/mysql stop
And then into mysql Install under directory bin Catalog , perform :
./mysqld_safe --user=mysql --skip-grant-tables --skip-networking & |
Log in again mysql -u root -p, You can log in . Here's the picture

Execute after entering :mysql> flush PRIVILEGES;
Reset password : mysql> alter user 'root'@'localhost' identified by '1234567';
perform mysql>fulsh tables; sign out . You can use the new password when logging in again .

5.7 mysql Allow remote access

First, turn off the server firewall .
Sign in mysql, see mysql In the library user Tabular host Field

Host Field ,localhost Indicates that only local access is allowed , To achieve a remote connection , Need to put root User host Change it to % To allow to be arbitrary host visit . Then use the command mysql> flush privileges; Make this amendment effective immediately .

Connect remotely again , success !

边栏推荐
- 产品经理访谈 | 第五代验证码的创新与背景
- [C language] Pointer advanced knowledge points
- C language operators and input and output
- flask_ Mail source code error
- Basic mathematical knowledge (update)
- Practice of real-time push demo of three web messages: long polling, iframe and SSE
- [C language] Pointer elementary knowledge points
- Commands related to obtaining administrator permissions
- Does any elder brother know how to solve the huge flinksql log
- Zfoo adds routes similar to mydog
猜你喜欢

C language pointer and two-dimensional array

XOR operation and its usage

Raspberrypico serial communication

4. Const and difine and the problem of initializing arrays with const and define

C language data 3 (1)

产品经理访谈 | 第五代验证码的创新与背景

NEIL: Extracting Visual Knowledge from Web Data

A chip company fell in round B

【实验分享】CCIE—BGP反射器实验
![[C language] initial C language reflection and summary](/img/21/826d144867f7a73ec2cd8896a5250a.png)
[C language] initial C language reflection and summary
随机推荐
LeetCode-297-二叉树的序列化与反序列化
WPF--实现WebSocket服务端
Merge sort template
[C language] simulation implementation of pow function (recursion)
Array out of bounds
字符设备驱动结构
3、 Are formal and actual parameters in a programming language variables?
6. Functions of C language, why functions are needed, how functions are defined, and the classification of functions
WPF -- implement websocket server
A chip company fell in round B
C language - pointer
Basic knowledge of communication network 01
9. Pointer of C language (5) how many bytes does the pointer variable occupy
Implementation of strstr in C language
2. Floating point number, the difference between float and double in C language and how to choose them
Common instructions of vim software
Raspberrypico analytic PWM
[C language] shutdown game [loop and switch statement]
NEIL: Extracting Visual Knowledge from Web Data
4. Const and difine and the problem of initializing arrays with const and define