当前位置:网站首页>Ubuntu and MySQL quick start tutorial
Ubuntu and MySQL quick start tutorial
2022-07-27 10:17:00 【Xiang Yu Han】
Write it at the front , as everyone knows , ECS is quite popular in the era , Create your own virtual cyberspace , I am full of expectations .
This article explains the existing Cloud server Under the premise of , This paper introduces the creation of a complete database and the cognition of user management , These are contents that cannot be accessed by large companies . after , Will fully introduce how to use springboot Set up the project , And design 、 Research and development 、 Test and release a app Or a little program , Understand the process and connection matters of each link of project management .
A little flowers , Go straight to the point :
One 、 install mysql
sudo apt update
to update apt Indexes ;
sudo apt install mysql-server
install mysql database , All the way 【yes】 down , No password setting option ;
sudo mysql_secure_installation
Run security scripts , Password detection plug-in 、 Set the password ;
mysql -V
Show installation mysql Information about , for example : edition 、 System ;
Two 、 modify root User login method
sudo mysql
Get into mysql database ;
SELECT user,authentication_string,plugin,host FROM mysql.user;
Show the authentication methods of all users 【 Two types of : Password authentication 、auth_socket Plug in authentication 】;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ' Your database password ';
by root User set password ;
FLUSH PRIVILEGES;
take effect ;
SELECT user,authentication_string,plugin,host FROM mysql.user;
Check whether it is effective ;
exit;
sign out ;
sudo mysql;
Report errors , Because it has been changed to password authentication login ;
mysql -u root -p
Password authentication login , Just enter the password ;
3、 ... and 、 establish 、 Delete database
mysql -u root -p;
Use root Role users log into the database ;
show databases;
Show database list ;
create database srping;
Create a srping The database of ;
create database test;
Create a test The database of ;
show databases;
Show database list , You can see that the above two databases have been created ;
drop database test;
Delete the name test The database of ;
show databases;
Show database list , Verify that the deletion was successful ;
Four 、 Create a new user , And authorize Authority
mysql -u root -p
Input password , Login database ;
CREATE USER 'xiaochun'@'localhost' IDENTIFIED BY ' Your high-strength password ';
Create user name as xiaochun Users of , And set the password as 【 Your high-strength password 】
show grants for 'xiaochun'@'localhost';
Show spring User's rights , Because permission is not granted , You can see the default permissions :
// GRANT USAGE ON *.* TO 'xiaochun'@'localhost'
// namely USAGE( Only login is allowed )
exit;
sign out ;
mysql -u xiaochun -p
Verify whether you can log in , Input password , Login database ;
exit;
sign out ;
mysql -u root -p
Replace with root user ;
// Introduce the format of authorization command : grant A on B to C
// A: User operation permission ,SELECT,INSERT,UPDATE,privileges,all ,USAGE( Only login is allowed )
// B: Authorized person ,*.* Represents all databases, all tables ; You can also specify a database 、 Table under database
// C: user name
grant all privileges on spring.* to 'xiaochun'@'localhost';
Give to users 【xiaochun】 Give the database the name 【 spring】 All operation rights ;
flush privileges;
Refresh permission table ;
show grants for 'xiaochun'@'localhost';
Check for authorization ;
exit;
sign out ;
mysql -u xiaochun -p
Change user login ;
show grants for 'xiaochun'@'localhost';
Verify whether authorization is given ;
exit;
thus , All training items are introduced , Next class , Introduce window Connect the remote server database locally under the platform .
Add
Revoke user privileges
REVOKE privilege ON databasename.tablename FROM 'username'@'host';
explain :
privilege, databasename, tablename: Same authorization part
Example :
REVOKE SELECT ON *.* FROM 'pig'@'%';
Set and change user passwords
SET PASSWORD FOR 'username'@'host' = PASSWORD('newpassword');
If it is the current login user :
SET PASSWORD = PASSWORD("newpassword");
Example :
SET PASSWORD FOR 'pig'@'%' = PASSWORD("123456");
边栏推荐
- pytorch中对BatchNorm2d()函数的理解
- Word2vec principle and application and article similarity (recommended system method)
- Matlab-绘制日期和持续时间图
- 蚂蚁集团境外站点 Seata 实践与探索
- vs2019社区版下载教程(详细)
- Metaspolit
- hugo学习笔记
- VS2019+CUDA11.1新建项目里没有CUDA选项
- How to create a.Net image with diagnostic tools
- Shell的正则表达式入门、常规匹配、特殊字符:^、$、.、*、字符区间(中括号):[ ]、特殊字符:\、匹配手机号
猜你喜欢

Decision tree principle and case application - Titanic survival prediction

hdu5288(OO’s Sequence)

Leetcode.1260. 2D grid migration____ In situ violence / dimensionality reduction + direct positioning of circular array

WGAN、WGAN-GP、BigGAN

Shell read read console input, use of read

Oracle查看硬解析

Concurrent Park and unpark description

Food safety | is sugar free really sugar free? These truths need to be known

线代003

数据库性能系列之子查询
随机推荐
hdu5288(OO’s Sequence)
并发之线程状态转换
并发之park与unpark说明
Introduction to Matlab real time editor
Shell综合应用案例,归档文件、发送消息
视觉SLAM十四讲笔记(一):第一讲+第二讲
TFlite 的简单使用
Snowflake vs. databricks who is better? The latest war report in 2022
Matlab- draw superimposed ladder diagram and line diagram
Snowflake vs. Databricks谁更胜一筹?2022年最新战报
Provincial Emergency Management Department: Guangzhou can strive to promote the experience of emergency safety education for children
Visual slam lecture notes (I): Lecture 1 + Lecture 2
File upload of native input tag
Matlab-基于短时神经网络的声音分类
SE(Squeeze and Excitation)模块的理解以及代码实现
Pytorch installation (very detailed)
Food safety | is sugar free really sugar free? These truths need to be known
直播倒计时 3 天|SOFAChannel#29 基于 P2P 的文件和镜像加速系统 Dragonfly
Girl fan wants to find a boyfriend, but it's for
Understanding of batchnorm2d() function in pytorch