当前位置:网站首页>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 !

边栏推荐
- Using Lex (Flex) to generate lexical analyzer of PL language
- [C language] Pointer advanced knowledge points
- 熊市下PLATO如何通过Elephant Swap,获得溢价收益?
- Common instructions of vim software
- 数据挖掘(数据预处理篇)--笔记
- Windows系统下Mysql数据库定时备份
- Solve the problem of adding the least number of parentheses (interval DP)
- 9. Pointer of C language (5) how many bytes does the pointer variable occupy
- 跨区域网络的通信学习静态路由
- 基于 MinIO 对象存储保障 Rancher 数据
猜你喜欢

Multi-Modal Knowledge Graph Construction and Application: A Survey

2. Floating point number, the difference between float and double in C language and how to choose them

Quick sort template

Raspberry connects EC20 for PPP dialing
![[C language] random number generation and `include < time. H > 'learning](/img/bb/3e47bf2e3b25653d9048884d65cda3.png)
[C language] random number generation and `include < time. H > 'learning

Zfoo adds routes similar to mydog

Why is customer support important to SaaS?

C语言数据 3(2)

Merge sort template

Stories of Party members | Li qingai uses cartoons to drive farmers to increase income and become rich
随机推荐
8. Compilation errors of C language and Chinese explanation
【CodeForces】Educational Codeforces Round 132 (Rated for Div. 2)
[C language] advanced pointer exercise 1
Method number problem for solving sum of numbers (knapsack problem)
[C language] Gobang game [array and function]
[C language] comprehensively analyze the pointer and sort out the pointer knowledge points
Implementation of strstr in C language
C language functions and pointers
[C language] Pointer elementary knowledge points
4. Const and difine and the problem of initializing arrays with const and define
为什么客户支持对SaaS公司很重要?
跨区域网络的通信学习静态路由
[C language] shutdown game [loop and switch statement]
How to automatically store email attachments in SharePoint
Representation of base and number 2
熊市下PLATO如何通过Elephant Swap,获得溢价收益?
New fruit naming (DP is similar to the longest common subsequence)
C language data 3 (1)
Using typedef in C language to change the name of data type
2、 Relationship between software operation and memory