当前位置:网站首页>Chapter 15 MySQL user management
Chapter 15 MySQL user management
2022-07-26 22:19:00 【Crazy snail】
Section 1 : Login and roll out mysql The server
start-up mysql After the server , You can use mysql Command to log in mysql The server , The order is as follows :
mysql -h hostname|hostip -P port -u username -p DatabaseName -e "sql sentence "
Several parameters of this command are as follows :
-h The parameter is followed by the host name or host IP,hostname The host name is ,hostip Host computer IP
-P Parameters are followed by Mysql Port of service , Log in to Mysql Designated port .mysql The default port of the service is 3306, Automatically connect to... When this parameter is not applicable 3306 port ,port Is the port number of the connection .
-u Parameter followed by user name .username Is the user name .
-p The parameter will prompt the user to enter the password ( After entering this statement, you will be prompted to enter the password window )
-e Parameters can be directly followed by mysql sentence . Sign in mysql This can be executed immediately after the server SQL sentence , And then quit mysql The server .
Let's start with a simpler :
stay win Enter... On the command line :
mysql -h localhost -uroot -p
The following -h Replace it with the host ip, as follows :

Let's have another one by ourselves :


mysql perform :
mysql -h127.0.0.1 -uroot -P 3306 mysql -e "select * from db" -p 
It can be seen that , If there is -e Options , Then run this statement immediately after logging into the database , It was launched immediately after the operation mysql The server .
In the second quarter :mysql New normal user
1. use CREATE USER To create users :
mysql use CREATE USER To create new users ( Of course there must be CREATE USER jurisdiction ).CREATE USER The basic grammatical structure of is as follows :
![]()
for example : Execute the following statement to create a user :user1, The password is user1
CREATE USER 'user1'@'localhost' identified by 'user1';After executing the above statement , Try logging in :

The result shows that login succeeded .
2. Try to use insert Command to create a user :
边栏推荐
猜你喜欢

Knowledge base tools | wechat, document center, image display page can be generated by dragging (with template, directly used)

MOS 管示意图
![[waiting and wakeup of QT multithreaded threads]](/img/9b/fe16926dc126e93f155b0162cc329d.png)
[waiting and wakeup of QT multithreaded threads]

Xiaobai learns MySQL - derived table

【Qt多线程之线程的等待和唤醒】

day07-

08 du 命令

JDBC summary

Basic operation of (C language) files

SQL injection less24 (secondary injection)
随机推荐
OPPO 自研大规模知识图谱及其在数智工程中的应用
[RequireComponent(typeof(....))]
Altium designer 22 modify the layer properties of the selected component
matlab 短时自相关实现
VB.net Chart1的处理
Operating guidelines and suggestions for spot gold (Part 1)
Oppo self-developed large-scale knowledge map and its application in digital intelligence engineering
My SQL is OK. Why is it still so slow? MySQL locking rules
Is it safe to open an account for flush mobile stock trading? How to open an account
Determine the dimension of numpy array array
yolov1
Let me show you the MySQL isolation level. What happens when two transactions operate on the same row of data at the same time?
08 Du command
07 df 命令
[basics of C language] 17 preliminary study of linked list
判断numpy array数组的维数
SQL injection less26 (filter spaces and comments, and use error injection without spaces)
同花顺手机炒股开户安全吗?怎么办理开户呢
matlab 激励模型 三角波频谱
View绘制流程1-View与Window的关系