当前位置:网站首页>MySQL installation
MySQL installation
2022-04-23 17:21:00 【first quarter of the moon】
Form writing habits together ! This is my participation 「 Nuggets day new plan · 4 Yuegengwen challenge 」 Of the 20 God , Click to see the event details .
Hanshan Temple outside Suzhou , Midnight to the passenger ship .
1 Preface
In the process of project development ,mysql Is a frequently used storage database , In this article, I will introduce mysql Database installation and use , Will be divided into linux System installation and windows install , And some system configuration problems .
2 mysql install
Before installation , You need to clarify the installation method and path , The compiled source code package is adopted , The download address is as follows :
https://downloads.mysql.com/archives/community/
Copy code
You can choose according to the installation environment linux/centos/windows/mac Version of the file to download . In addition to mysql During startup , The configuration file of the system needs to be loaded , A default configuration file is provided below :
[mysqld]
# Database port and data file address socket File address , Configuration file about address windows and Linux There is a difference
port=3306
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysql.sock
# Set database users and maximum connections
user=mysql
max_connections=151
# Set ignore case
lower_case_table_names = 1
# Specified encoding
character-set-server=utf8
collation-server=utf8_general_ci
# Turn on ip binding
# bind-address = 0.0.0.0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
# Specify client connection mysql At the time of the socket Communication file path
[client]
socket=/usr/local/mysql/mysql.sock
default-character-set=utf8
Copy code
2.1 linux mysql install
stay linux In the system , The installation steps are as follows :
1 You need to download the installation package file first ,mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
2 Unzip the file into the installation directory ,tar -xzvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local
Create a soft connection ln -s mysql-5.7.18-linux-glibc2.5-x86_64 mysql
3 Create user groups and grant permissions
groupadd mysql -> useradd -r -g mysql -s /bin/mysql
cd /usr/local/mysql -> chown -R mysql:mysql ./
4 install mysql ./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
5 Add configuration file my.cnf And add it to the self startup file cp support-files/mysql.server /etc/init.d/mysqld
6 restart mysql service mysqld restart
7 Establish database connection account alter user 'root'@'localhost' identified by 'rootroot';
Copy code
2.2 windows mysql install
windows install mysql Database services are generally similar to linux It's similar , But there are differences in specific steps .linux The configuration file on is my.cnf, windows The configuration file on is my.ini. The following is a mysql Installation steps of :
1 Set the environment variable , First of all mysql Home directory , MYSQL_HOME D:\mysql-5.7.23-winx64, Then set the path Variable Path %MYSQL_HOME%\bin
2 Use the administrator to open cmd Tools ,c:/windows/system32 Use cmd.exe , Open as Administrator cmd, Switch to mysql_home/bin
3 perform perform mysqld.exe -install
4 perform mysqld -initialize-insecure Initialize the installation environment
5 perform net start mysql / net stop mysql start-up / stop it mysql service
6 perform mysqld -initialize, To initialize , Type on the command line mysql -uroot -p Enter directly into the console .
7 Set up root password set password for [email protected]=password('xxxxxxx');
Copy code
2.3 Database state
After installing the database , type status, You can see the database information as shown in the figure , Can display the account number of the database , database information , Database version , Character information, connection information and protocol version of the database , Current thread information statistics, etc .
3 Database password modification
View the password related configuration of the current database :
show variables like 'validate_password%';
Copy code
As shown in the figure above , Specifies the length of the password, the length of mixed characters and the number of string lengths , Security level and other data configuration . Change account password :
# The account and password of the lower version are modified
set password for [email protected]'localhost' = password('123456');
# In the high version, there is no... In the database password Field of , You need to use the following methods to modify your password
alter user 'root'@'localhost' identified by '123456';
Copy code
4 summary
In this paper mysql Installation information of the database and password setting of the database .
版权声明
本文为[first quarter of the moon]所创,转载请带上原文链接,感谢
https:https://yzsam.com/html/EUHoQw.html
边栏推荐
- How does matlab draw the curve of known formula and how does excel draw the function curve image?
- Milvus 2.0 质量保障系统详解
- Node template engine (EJS, art template)
- Net standard
- How to use the input table one-way service to send (occupy less) picture files (body transmission)? FileReader built-in object involved
- [ES6] promise related (event loop, macro / micro task, promise, await / await)
- [PROJECT] small hat takeout (8)
- XTask与Kotlin Coroutine的使用对比
- . net type transfer
- [registration] tf54: engineer growth map and excellent R & D organization building
猜你喜欢
groutine
Nacos + aspnetcore + Ocelot actual combat code
1-4 configuration executable script of nodejs installation
RPC核心概念理解
Use of five routing guards
[logical fallacy in life] Scarecrow fallacy and inability to refute are not proof
ASP. Net core JWT certification
线性代数感悟之1
[WPF binding 3] listview basic binding and data template binding
Use of todesk remote control software
随机推荐
Shell-入门、变量、以及基本的语法
Understanding and small examples of unity3d object pool
Customize my_ Strcpy and library strcpy [analog implementation of string related functions]
JS failed to change all variables and changed to the return method. Finally, the problem was solved
groutine
Go language, array, string, slice
matlab如何绘制已知公式的曲线图,Excel怎么绘制函数曲线图像?
Clickhouse table engine
Milvus 2.0 质量保障系统详解
Go language RPC communication
Using quartz under. Net core -- job attributes and exceptions of [4] jobs and triggers
Using quartz under. Net core -- general properties and priority of triggers for [5] jobs and triggers
[related to zhengheyuan cutting tools]
Generating access keys using JSON webtoken
【生活中的逻辑谬误】稻草人谬误和无力反驳不算证明
Detailed explanation of C webpai route
Collection of common SQL statements
Input file upload
Using quartz under. Net core -- a simple trigger of [7] operation and trigger
Shell script -- shell programming specification and variables