当前位置:网站首页>Install MySQL for Ubuntu and query the average score
Install MySQL for Ubuntu and query the average score
2022-04-23 08:13:00 【Bald again this year】
1: Download and install Mysql:
1.1 Download... On the official website :

1.2 Unzip the file : tar -xvf mysql-server_5.7.13-1ubuntu16.04_i386.deb-bundle.tar
1.3: install :
libmysqlclient20_5.7.13-1ubuntu16.04_i386.deb
libmysqlclient-dev_5.7.13-1ubuntu16.04_i386.deb
libmysqld-dev_5.7.13-1ubuntu16.04_i386.deb
mysql-common_5.7.13-1ubuntu16.04_i386.deb
mysql-community-source_5.7.13-1ubuntu16.04_i386.deb
mysql-community-client_5.7.13-1ubuntu16.04_i386.deb
mysql-community-server_5.7.13-1ubuntu16.04_i386.deb
mysql-server_5.7.13-1ubuntu16.04_i386.deb
1.4: Inquire about mysql Service status
service mysql start
1.5: Get into mysql
mysql -u root -p
2: Initialize configuration
sudo mysql_secure_installation
Configuration items :
#1
VALIDATE PASSWORD PLUGIN can be used to test passwords...
Press y|Y for Yes, any other key for No: N ( choice N , No strong password verification )
#2
Please set the password for root here...
New password: ( Input password )
Re-enter new password: ( Repeat input )
#3
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them...
Remove anonymous users? (Press y|Y for Yes, any other key for No) : N ( choice N, Don't delete anonymous users )
#4
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network...
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N ( choice N, allow root Remote connection )
#5
By default, MySQL comes with a database named 'test' that
anyone can access...
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N ( choice N, Don't delete test database )
#6
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y ( choice Y, The modification will take effect immediately )
2.2: Check mysql Service status :
systemctl status mysql.service

3: Configure remote access :
stay Ubuntu Next MySQL By default, only local access is allowed , Use workbench The connection tool cannot be connected ;
If you want other machines to be accessible as well , Configuration required ;
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf # find bind-address Modify value 0.0.0.0( If you need remote access )
sudo /etc/init.d/mysql restart # restart mysql
Enter the user password :
# Switch database
mysql>use mysql;
# Query user table command :
mysql>select User,authentication_string,Host from user;
# Check the status
select host,user,plugin from user;

# Set permissions and passwords
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ' password '; # Use mysql_native_password Modify encryption rules
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY ' password ' PASSWORD EXPIRE NEVER; # Update the user's password
mysql> UPDATE user SET host = '%' WHERE user = 'root'; # Allow remote access
# Refresh cache Middle configuration Refresh the permissions
mysql>flush privileges;
mysql>quit;
4 Create a new database and user :( Introduction to the steps )

Convert to logical data model , And check for logical errors , There is an error modifying the basic data model

Transform physical data model , And export Sql Execute statement , And run whether the table can be generated normally

5: The above operations and mysql After installation , start-up Mysql Server and enter mysql shell Interface :
5.1: establish jw database
create database jw;

5.2: Create a form of student grades :
use jw;
Design field list : Student number , full name , Gender , subject , achievement , Examination time
create table xscj (id int(3) auto_increment not null primary key, xm varchar(10),xb varchar(2),km varchar(30),cj int(3),kssj date);
After the student achievement form is established, use describe Command view table :
describe person;

5.3: insert data
insert into xscj values(null,' Li Xiaolong ',' Woman ',' Cloud computing and big data processing ',76,'2021-07-10');


The verification results :select
select * from xscj;

5.4: Calculate average :
select AVG(cj) from xscj where km=' Cloud computing and big data processing ' and kssj='2021-3-25';

The result is consistent with the calculated average score
版权声明
本文为[Bald again this year]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230648054921.html
边栏推荐
- 刨析——浏览器如何工作
- Quick rehearsal exercise
- Manipulator motion planning in 3C assembly
- 华硕笔记本电脑重装系统后不能读取usb,不能上网
- Concours de compétences en informatique en nuage - - première partie de l'environnement cloud privé openstack
- 分布式服务治理Nacos
- 每周leetcode - 06 数组专题 7~739~50~offer 62~26~189~9
- Mobile web (Font Icon, plane conversion, color gradient)
- 一个没啥L用,但可以装X的IDEA插件
- LeetCode15. 三数之和
猜你喜欢

Go语学习笔记 - 结构体 | 从零开始Go语言

使用 Ingress 实现金丝雀发布

三星,再次“西征”
![BUUCTF [ACTF2020 新生赛]Include1](/img/47/b8f46037f7e9476b8e01e8d6a7857a.png)
BUUCTF [ACTF2020 新生赛]Include1

Positioning of high precision welding manipulator

青苹果影视系统源码 影视聚合 影视导航 影视点播网站源码

LeetCode中等题之旋转函数

Comparison of indoor positioning methods of several intelligent robots

Kubernetes in browser and IDE | interactive learning platform killercoda

巨头押注的全屋智能,正在驱动海信、华为、小米们「自我革命」
随机推荐
LeetCode15. 三数之和
Data security has become a hidden danger. Let's see how vivo can make "user data" armor again
Ignis公链的NFT生态发展:Unicorn.art的捐赠开发之路
几种智能机器人室内定位方法对比
Anti shake and throttling
yum源仓库本地搭建的两种方法
Feign source code analysis
Research on system and software security (5)
Discussion on ES6 tail tune optimization
单点登录 SSO
1216_ MISRA_ C standard learning notes_ Rule requirements for control flow
Move layout (Flex layout, viewport label)
vslam PPT
[programming practice / embedded competition] learning record of embedded competition (II): picture streaming based on TCP
Jetson Xavier NX (3) bazel mediapipe installation
Brief description of CPU
Comparison of indoor positioning methods of several intelligent robots
mysql查询字符串类型的字段使用数字类型查询时问题
vivo,硬件安全的爱与雷霆
LeetCode简单题之统计字符串中的元音子字符串