当前位置:网站首页>[most complete] install MySQL on a Linux server
[most complete] install MySQL on a Linux server
2022-06-30 07:09:00 【A rookie is a great God】
take mysql Download to :/user/local/
cd /usr/local/
wget https://dev.mysql.com/get/Downloads/mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz
Here for download 8.0 edition , You can copy the corresponding version on the official website , Modify corresponding position , Such as : download 5.7 edition :
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
Unzip in this directory ;
tar -xzf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
1、*.tar use tar -xvf decompression
2、*.gz use gzip -d perhaps gunzip decompression
3、.tar.gz and .tgz use tar -xzf decompression
4、*.bz2 use bzip2 -d Or use bunzip2 decompression
5、*.tar.bz2 use tar -xjf decompression
6、*.Z use uncompress decompression
7、*.tar.Z use tar -xZf decompression
8、*.rar use unrar e decompression
9、*.zip use unzip decompression
10.*.tar.xz use tar -xJf decompression
Change the name of the extracted folder , Note: none here .tar.gz suffix , Otherwise, change the file name of the compressed package
mv mysql-5.7.24-linux-glibc2.12-x86_64 mysql
add to mysql The user group and user to which the folder belongs
groupadd mysql
useradd -r -g mysql mysql
Create a database directory and authorize , Be careful to execute cd / Create in the root directory
cd /
mkdir -p /data/mysql
To configure my.cnf file , Execute... In the root directory :
vim /etc/my.cnf
After opening, paste the following configuration code , Press Enter Key to exit INSERT Pattern , Input :wq Then press enter to save and exit :( Here, pay attention to press i Get into INSERT Mode editor )
[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
Initialize database , Get into mysql Of bin Catalog :
cd /usr/local/mysql/bin
Perform initialization and view mysql Account password :
./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql --initialize
View the initial password of the database under the root directory : Pay attention to the end of the printed log [email protected]:XXXXXXXXXXXXXX The following string is mysql Administrator temporary login password .
cd /
cat /data/mysql/mysql.err
take mysql.server Placed in /etc/init.d/mysql in
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
start-up mysql, And check to see if it started successfully
service mysql start
Next, modify the initial password of the database
Get into mysql Of bin Catalog :
cd /usr/local/mysql/bin
./mysql -u root -p
Enter the initial password of the acquired database , Carry out the following 3 An order , Change password and refresh permissions ;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
FLUSH PRIVILEGES;
边栏推荐
- Linux服務器安裝Redis
- 大学刚毕业不知道做什么工作怎么办?
- 如果我在珠海,到哪里开户比较好?另外,手机开户安全么?
- Redis cache
- Install the components corresponding to setup
- Installation du serveur linux redis
- The class imported by idea import clearly exists, but it is red?
- QT signal slot alarm QObject:: connect:cannot connect (null)
- 【已解决】Failed! Error: Unknown error 1130
- Resolution: div failed to get keyboard event
猜你喜欢
tomorrow! "Mobile cloud Cup" competition air publicity will start!
How to set the hot deployment of idea web project
Pit stepping record: Supervisor log return information: redis extension is not installed
Linux服務器安裝Redis
Go常用命令
Record one time of Tencent Test Development Engineer's automation interface test practice experience
Definition and use of ROS topic messages
六,购物⻋与订单
【json-tutorial】第一章学习笔记
The maximum expression in Oracle database message list is 1000 error
随机推荐
Assembly language learning I (with stack co process, 32-bit registers and related instructions, to be continued 06/29)
Detailed analysis of message signals occupying multiple bytes and bits
Linu foundation - zoning planning and use
[semidrive source code analysis] [x9 chip startup process] 33 - Analysis of related concepts of display module
Determine whether the picture is in JPG picture format
[Hot100]回文子串 与 最长回文子串
B站首个UP主付费观看视频还是来了!价格“劝退”网友
Go common commands
What does the real name free domain name mean?
Traverse map
Browser downloads files as attachments
Servlet principle
What if I forget my account number after opening an account? Is it safe to open an account online?
Steps for formulating class or file templates in idea
If I am in Zhuhai, where can I open an account? In addition, is it safe to open a mobile account?
6、 Shopping ⻋ and orders
IDEA import导入的类明明存在,却飘红?
六,购物⻋与订单
Definition and use of ROS topic messages
Qdebug small details