机器学习解决什么问题_机器学习帮助解决水危机

机器学习解决什么问题

According to Water.org and Lifewater International, out of 57 million people in Tanzania, 25 million do not have access to safe water. Women and children must travel each day multiple times to gather water when the safety of that water source is not even guaranteed. In 2004, 12% of all deaths in Tanzania were due to water-borne illnesses.

根据Water.org和Lifewater International的数据 ,坦桑尼亚的5700万人中,有2500万人无法获得安全的水。 妇女和儿童必须每天多次旅行以收集水,甚至不能保证该水源的安全。 2004年,坦桑尼亚所有死亡中有12%是由于水传播疾病造成的。

Despite years of effort and large amounts of funding to resolve the water crisis in Tanzania, the problem remains. The ability to predict the condition of water points in Tanzania using collectible data will allow us to build plans to efficiently utilize resources to develop a sustainable infrastructure that will affect many lives.

尽管为解决坦桑尼亚的水危机付出了多年的努力和大量资金,但问题仍然存在。 利用可收集的数据预测坦桑尼亚水位状况的能力将使我们能够制定计划,以有效利用资源来开发将影响许多生命的可持续基础设施。

数据 (Data)

As an initiative to resolve this issue, DrivenData started an exploration-based competition using data from the Tanzania Ministry of Water gathered by Taarifa, an open-source platform. The goal of the project is to predict the status of each water point in three different classes: functional, not functional and needs repair.

为了解决这个问题, DrivenData使用开放源代码平台Taarifa收集的坦桑尼亚水利部的数据,开始了基于勘探的竞赛。 该项目的目标是预测三个不同类别中每个供水点的状态:功能性,非功能性和需要维修。

Image for post

Our dataset showed that 62% of the 59,400 water points were functional while 38% were not. Out of these functional water points, 12% of them needed repairs.

我们的数据集显示,在59,400个供水点中,有62%可以正常工作,而38%则没有。 在这些功能性供水点中,有12%需要维修。

探索性数据分析 (Exploratory Data Analysis)

After cleaning the data and dealing with missing values and abnormalities, we’ve looked at how individual features may relate to the condition of water points. Here are a few observations from our exploratory data analysis.

清理数据并处理缺失值和异常之后,我们研究了各个特征如何与水位状况相关。 以下是我们探索性数据分析的一些观察结果。

不维护较旧的水位 (Older Water Points Are Not Maintained)

Image for post

Here is the distribution of water points across different years of construction. We can see that most water points that are functional were built recently, which is perhaps due to the large funding that has gone in recent years. But the fact that even the ones that were built recently are as likely to be not functional as older ones is quite alarming.

这是不同施工年份的水位分布。 我们可以看到,大多数具有功能的供水点都是在最近建造的,这可能是由于近年来已投入大量资金。 但是,即使是最近制造的设备也无法像旧设备一样运行,这一事实令人震惊。

付款事宜。 (Payment Matters.)

Image for post

Steady payment plans seem to be a strong indicator of whether the water points would be maintained or not. The problem is that while the responsibility to maintain the water points is left to each community, most communities in Tanzania do not make enough money to upkeep these water points.

稳定的付款计划似乎是水位是否得以维持的有力指标。 问题是,维护水位的责任留给每个社区,但坦桑尼亚的大多数社区没有赚到足够的钱来养护​​这些水位。

位置事项 (Location Matters)

Location of water points and their conditions

Based on this map of Tanzania, we can see that water point conditions tend to cluster around different areas. This tells us that location is an important predictor of this problem.

根据坦桑尼亚的这张地图,我们可以看到水位状况倾向于聚集在不同地区。 这告诉我们位置是此问题的重要预测因素。

特征工程 (Feature Engineering)

Based on our exploratory data analysis, we decided to expand on the features containing location information. First, we found the location of the basin based on its name and calculated the distance to the basin from the water points.

根据我们的探索性数据分析,我们决定扩展包含位置信息的功能。 首先,我们根据其名称找到盆地的位置,并计算出从水位到盆地的距离。

Finding the location is done using Geopy’s Nominatim package, which uses the OpenStreetMap data.

使用Geopy的Nominatim包来查找位置,该包使用OpenStreetMap数据。

from geopy.geocoders import Nominatimdef get_lat_long(location):# takes location string and return its longitude and latitudegeolocator = Nominatim(user_agent = "Tanzania_water")location = geolocator.geocode(location)return (location.longitude, location.latitude)# all unique basin from df basin column
basins = set(df.basin) 
# turn them into a dictionary
allbasins = dict.fromkeys(basins, ()) # for each basin, get long/lat and put in allbasins, 
# otherwise throw an error
for bas in basins:if allbasins[bas] != (): continuetry:allbasins[bas] = get_lat_long(bas)except AttributeError:print(f"error: {bas}")

Then we calculated the distance using the geodesic distance from Geopy.

然后,我们使用距Geopy的测地线距离来计算距离。

from geopy.distance import geodesicdef get_dist(crd1, crd2): # take two tuples of lat, long # and return distance in milesreturn geodesic(crd1, crd2).miles# apply it to the dataframe
df['dist_to_basin'] = df.apply(lambda x: get_dist((x.latitude, x.longitude), (x.basin_lat, x.basin_long)), axis = 1)

Also, we engineered several other features including whether the location is in the urban or rural area and the total number of other wells in the village.

此外,我们还设计了其他几个功能,包括该位置在城市还是农村地区以及该村中其他水井的总数。

前处理 (Preprocessing)

重采样 (Resampling)

Our data has a class imbalance issue, meaning that there are way more functional water points than the water points needing repairs. This can bias the prediction towards the majority class, so we used the SMOTE (synthetic minority oversampling technique) to resample our data. Simply put, SMOTE oversamples by synthesizing new samples that are close in distance to existing ones within the same class.

我们的数据存在类不平衡问题,这意味着功能上的供水点比需要维修的供水点还多。 这可能会使预测偏向多数类,因此我们使用SMOTE(合成少数过采样技术)对数据进行了重新采样。 简而言之,SMOTE通过合成与同一类别中现有样本距离最近的新样本来进行过采样。

from imblearn.over_sampling import SMOTEsmote = SMOTE() # initializing
X_train, y_train = smote.fit_sample(X_train, y_train)

In addition to resampling, we also converted the categorical features into binary dummies and standardized all features.

除了重新采样外,我们还将分类特征转换为二进制虚拟变量并标准化了所有特征。

功能选择 (Feature Selection)

Our original data had many categorical features, which resulted in a relatively large number of features after one-hot-encoding of categorical features. To optimize computation, we decided to run a tree-based feature selection.

我们的原始数据具有许多分类特征,在对分类特征进行一次热编码之后,导致了相对大量的特征。 为了优化计算,我们决定运行基于树的特征选择。

from sklearn.ensemble import ExtraTreesClassifier
from sklearn.feature_selection import SelectFromModel# fit to a few random decision trees
etc = ExtraTreesClassifier(n_estimators=100, class_weight='balanced', n_jobs=-1)
etc = etc.fit(X_train, y_train)
# select ones with feature importance less than 0.0001
model = SelectFromModel(etc, prefit=True, threshold = 1e-4)
# tranform the data
X_train_new = model.transform(X_train)
# return the list of new features
new_feats = original_feats[model.get_support()]

模型评估 (Model Evaluation)

评估指标 (Evaluation Metrics)

Deciding on the evaluation metrics that align with the project goal is very important (if you need a refresher, see HERE). We approached this problem with two primary purposes, one is to build a model with the highest overall accuracy and another is to build a model that successfully predicts the needs repair cases. The latter was important because predicting the needs repair cases accurately is directly related to changes that affect many people’s lives in Tanzania. But for this post, I will evaluate models in terms of overall accuracy.

确定与项目目标保持一致的评估指标非常重要(如果需要复习,请参阅此处 )。 我们通过两个主要目的解决了这个问题,一个目的是建立具有最高总体准确性的模型,另一个目的是建立一个能够成功预测需求修复案例的模型。 后者之所以重要,是因为准确预测需求修复案例与影响坦桑尼亚许多人生活的变化直接相关。 但是对于这篇文章,我将根据整体准确性评估模型。

虚拟分类器 (Dummy Classifier)

First, we started by fitting a dummy classifier as our baseline model. Our dummy classifier used the stratified approach, meaning it made predictions based on the proportion of each class.

首先,我们首先将虚拟分类器拟合为基线模型。 我们的虚拟分类器使用分层方法,这意味着它根据每个类的比例进行预测。

from sklearn.metrics import accuracy_score
from sklearn.dummy import DummyClassifier# dummy using the default stratified strategy
dummyc = DummyClassifier(strategy = 'stratified') 
dummyc.fit(X_train, y_train)
y_pred = dummyc.predict(X_test)# report scores! 
def scoring (y_test, y_pred):accuracy = round(accuracy_score(y_test, y_pred), 3)print('Accuracy: ', accuracy)scoring(y_test, y_pred)

Please note that the X_test in this code refers to our validation set. We have set aside the holdout set to test the final model at the end.

请注意,此代码中的X_test是指我们的验证集。 我们预留了保留集,以在最后测试最终模型。

# Dummy result: Accuracy:  0.33

Our dummy showed approximately 33% accuracy, which is an expected performance of a dummy for classifying three classes.

我们的假人显示出约33%的准确性,这是假人对三类进行分类的预期性能。

K最近邻居 (K-Nearest Neighbors)

The first model we tested was the K-Nearest Neighbors (KNN). The KNN classifies based on the classes of the k number of closest observations. The hyperparameter tuning was achieved by the Optuna. We tested the performance of both GridSearchCV and Optuna and found Optuna to be much more versatile and efficient.

我们测试的第一个模型是K最近邻居(KNN)。 KNN基于k个最接近的观测值的类别进行分类。 超参数调整是通过Optuna实现的。 我们测试了GridSearchCV和Optuna的性能,发现Optuna更具通用性和效率。

from sklearn.neighbors import KNeighborsClassifier
import optuna
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_scoredef find_hyperp_KNN(trial):## Setting parameter n_neighbors = trial.suggest_int('n_neighbors', 1, 31)algorithm = trial.suggest_categorical('algorithm', ['ball_tree', 'kd_tree'])p = trial.suggest_categorical('p', [1, 2])## initialize the modelknc = KNeighborsClassifier(weights = 'distance', n_neighbors = n_neighbors, algorithm = algorithm, p = p)## assigning K-fold cross validationcv = KFold(n_splits = 5, shuffle = True, random_state = 20)## calculate the average accuracy score on 5-folds cross validationsscore = np.mean(cross_val_score(knc, X_train, y_train, scoring = 'accuracy', cv = cv, n_jobs = -1))return (score)# initiating the optuna study, maximize accuracy
knn_study = optuna.create_study(direction='maximize')# run optimization for 100 trials
knn_study.optimize(find_hyperp_KNN, n_trials = 100) # use timeout to set the timer# Testing the best params on the test set
knc_opt = KNeighborsClassifier(**knn_study.best_params)
knc_opt.fit(X_train, y_train)
y_pred = knc_opt.predict(X_test)
scoring(y_test, y_pred)
# KNN Result - Accuracy: 0.752

随机森林分类器 (Random Forest Classifier)

Next, we tested the random forest classifier with Optuna hyper-tuning. The random forest simultaneously fits multiple decision trees on a subset of the data then aggregates the results.

接下来,我们使用Optuna超调测试了随机森林分类器。 随机森林同时将多个决策树适合数据的子集,然后汇总结果。

from sklearn.ensemble import RandomForestClassifierdef find_hyperparam_rf(trial):### Setting hyperparameter options ###n_estimators = trial.suggest_int('n_estimators', 100, 700)min_samples_split = trial.suggest_int('min_samples_split', 2, 10)min_samples_leaf = trial.suggest_int('min_samples_leaf', 1, 10)criterion = trial.suggest_categorical('criterion', ['gini', 'entropy'])class_weight = trial.suggest_categorical('class_weight', ['balanced', 'balanced_subsample'])max_features = trial.suggest_int('max_features', 2, X_train.shape[1]) # consider using float insteadmin_weight_fraction_leaf = trial.suggest_loguniform('min_weight_fraction_leaf', 1e-7, 0.1)max_leaf_nodes = trial.suggest_int('max_leaf_nodes', 10, 200)### Initializingrfc = RandomForestClassifier(oob_score = True, n_estimators = n_estimators,min_samples_split = min_samples_split,min_samples_leaf = min_samples_leaf,criterion = criterion,class_weight = class_weight, max_features = max_features,min_weight_fraction_leaf=min_weight_fraction_leaf, max_leaf_nodes = max_leaf_nodes)### Setting KFolds Crossvalidationcv = KFold(n_splits = 5, shuffle = True, random_state = 20)### get the average accuracy score of 5 foldsscore = np.mean(cross_val_score(rfc, X_train, y_train,scoring = 'accuracy', cv = cv, n_jobs = -1))return (score)# initialize the study
rfc_study = optuna.create_study(direction='maximize')
# run it for 3 hours or for 100 trials
rfc_study.optimize(find_hyperparam_rf, timeout = 3*60*60, n_trials = 100)# fit the model
rf = RandomForestClassifier(oob_score = True, **rfc_study.best_params)
rf.fit(X_train, y_train)
y_pred_rf = rf.predict(X_test)
scoring(y_test, y_pred_rf)
# Random Forest Results - Accuracy : 0.74

The performance of KNN was better than the random forest classifier for this problem. But even though not reported here, the random forest classifier did a much better job at classifying the minority class than the KNN.

对于该问题,KNN的性能优于随机森林分类器。 但是,尽管这里没有报告,但随机森林分类器在分类少数族群方面比KNN的工作要好得多。

XGBoost (XGBoost)

Since we tested a bagging method, we also tried a boosting method, using the XGBoost. It’s an implementation of a gradient boosting model, which iteratively trains the weak learners based on the prediction errors it makes.

由于我们测试了装袋方法,因此我们也尝试了使用XGBoost的加强方法。 它是梯度提升模型的实现,该模型根据其产生的预测误差迭代地训练弱学习者。

import xgboost as xgbdef find_hyperparam(trial):### Setting hyperparameter range ###eta = trial.suggest_loguniform('eta', 0.001, 1)max_depth = trial.suggest_int('max_depth', 1, 50)subsample = trial.suggest_loguniform('subsample', 0.4, 1.0)colsample_bytree = trial.suggest_loguniform('colsample_bytree', 0.01, 1.0)colsample_bylevel = trial.suggest_loguniform('colsample_bylevel', 0.01, 1.0)colsample_bynode = trial.suggest_loguniform('colsample_bynode', 0.01, 1.0)# Initializing the modelxgbc = xgb.XGBClassifier(objective = 'multi:softmax', eta = eta, max_depth = max_depth, subsample = subsample, colsample_bytree = colsample_bytree, colsample_bynode = colsample_bynode, colsample_bylevel = colsample_bylevel)# Setting up k-fold crossvalidationcv = KFold(n_splits = 5, shuffle = True, random_state = 20)# evaluate using accuracyscore = np.mean(cross_val_score(xgbc, X_train, y_train, scoring = 'accuracy', cv = cv, n_jobs = -1))return (score)# initializing optuna study
xgb_study = optuna.create_study(direction='maximize')
# run optimization for 3 hours or for 100 trials
xgb_study.optimize(find_hyperparam, timeout = 3*60*60, n_trials = 100)# testing on the test set
xgbc = xgb.XGBClassifier(**xgb_study.best_params, verbosity=1, tree_method = 'gpu_hist')
xgbc.fit(X_train, y_train)
y_pred = xgbc.predict(X_test)    
scoring(y_test, y_pred, 'xgboost')
# XGBoost Results - Accuracy: 0.78

XGboost showed improvement in the accuracy score, and its sensitivity in predicting minority class was also higher than the other two models.

XGboost的准确性得分有所提高,并且其预测少数族裔类别的敏感性也高于其他两个模型。

投票分类器 (Voting Classifier)

Lastly, we took all the previous models and put them to vote. When using a voting classifier, we can either combine each model’s prediction on the probability of each class (soft) or use its binary choice of each class (hard). Here, we used soft voting.

最后,我们采用了所有以前的模型并将它们投票。 使用投票分类器时,我们可以结合每个模型对每个类别的概率的预测(软),也可以使用其对每个类别的二进制选择(困难)。 在这里,我们使用了软投票。

from sklearn.ensemble import VotingClassifiervoting_c_soft = VotingClassifier(estimators = [('knc_opt', knc_opt),('rf', rf),('xgbc', xgbc)], voting = 'soft', n_jobs = -1)
# fit on training, test on testing set
voting_c_soft.fit(X_train, y_train)
y_pred = voting_c_soft.predict(X_test)    
scoring(y_test, y_pred, 'voting')
# Voting Classifier - Accuracy: 0.79

Voting classifier returns slightly higher accuracy and similar recall for the minority class. We decided to continue with the voting classifier as our final model and test the holdout test set.

投票分类器返回的准确性略高,而少数民族分类的召回率相似。 我们决定继续使用投票分类器作为最终模型,并测试保留测试集。

最终模型表现 (Final Model Performance)

Our final model showed 80% prediction accuracy on the holdout set (baseline 45%), and close to 50% recall on the minority class, which is a significant improvement from 6% recall by the baseline model.

我们的最终模型在保留集上具有80%的预测准确度 (基线45%),而在少数群体上的召回率接近50%,与基线模型的6%召回率相比有显着改善。

Image for post
Photo by ngozi Assata on Unsplash
由ngozi Assata 摄于Unsplash

奖金:口译 (Bonus: Interpretation)

Because our final model involved voting between a distance algorithm and tree-based ensembles, it’s difficult to interpret the feature importance of our model. But additional analysis using a logic regression with the Elastic Net regularization and SGD training showed that enough quantity of water, use of communal standpipes, and being recently built were the important predictors of the functional water points.

由于我们的最终模型涉及距离算法和基于树的集成体之间的投票,因此很难解释模型的特征重要性。 但是,使用带有Elastic Net正则化和SGD训练的逻辑回归进行的其他分析表明,充足的水量,公用竖管的使用和近期兴建的水是功能性水位的重要预测指标。

On the other hand, the location was an important predictor of non-functional water points. Especially some of the northern regions closer to Lake Victoria were highly related to the non-functioning water points. Lastly, GPS heights of water point showed different patterns between the non-functional and ones that need repair. Further investigation is necessary to find the significance of GPS heights whether it’s related to the specific government area, or the difference in accessibility, or whether it has any technical implication to some of the extraction types.

另一方面,该位置是非功能水位的重要预测指标。 尤其是靠近维多利亚湖的一些北部地区与无法正常工作的水位高度相关。 最后,GPS的水位高度在非功能性和需要修复的位置之间显示出不同的模式。 无论是与特定的政府区域有关,还是在可达性方面的差异,或者对某些提取类型有任何技术影响,都必须进行进一步的调查来确定GPS高度的重要性。

This project was done in collaboration with my colleague dolcikey.

这个项目是与我的同事dolcikey合作完成的。

翻译自: https://towardsdatascience.com/machine-learning-to-help-water-crisis-24f40b628531

机器学习解决什么问题

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/389166.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Viewport3D 类Viewport3D 类Viewport3D 类

.NET Framework 类库Viewport3D 类更新:2007 年 11 月为三维可视内容提供呈现图面。命名空间: System.Windows.Controls程序集: PresentationFramework(在 PresentationFramework.dll 中)用于 XAML 的 XMLNS&#xf…

网络浏览器如何工作

Behind the scenes of modern Web Browsers现代Web浏览器的幕后花絮 The Web Browser is inarguably the most common portal for users to access the web. The advancement of the web browsers (through the series of history) has led many traditional “thick clients”…

让自己的头脑极度开放

为什么80%的码农都做不了架构师?>>> 一. 头脑封闭和头脑开放 头脑封闭 你是否经常有这样的经历,在一次会议或者在一次小组讨论时,当你提出一个观点而被别人否定时,你非常急迫地去反驳别人,从而捍卫自己的尊…

简介DOTNET 编译原理 简介DOTNET 编译原理 简介DOTNET 编译原理

简介DOTNET 编译原理 相信大家都使用过 Dotnet ,可能还有不少高手。不过我还要讲讲Dotnet的基础知识,Dotnet的编译原理。 Dotnet是一种建立在虚拟机上执行的语言,它直接生成 MSIL 的中间语言,再由DotNet编译器 JIT 解释映象为本机…

RecyclerView详细了解

关于RecyclerView大家都不陌生了,它的使用也越来越受欢迎,现在总体了解一下RecyclerView的作用,为什么会有RecyclerView呢,我用ListView也能干所有的事情啊,尺有所短,寸有所长,先来看看Recycler…

案例与案例之间的非常规排版

In 1929 the Cond Nast publishing group brought Russian-born Mehemed Fehmy Agha—who had been working for the German edition of Vogue magazine—to America as art director for House & Garden, Vanity Fair, and the senior edition of Vogue.1929年&#xff0c…

熊猫分发_熊猫新手:第二部分

熊猫分发This article is a continuation of a previous article which kick-started the journey to learning Python for data analysis. You can check out the previous article here: Pandas for Newbies: An Introduction Part I.本文是上一篇文章的延续,该文…

浅析微信支付:申请退款、退款回调接口、查询退款

本文是【浅析微信支付】系列文章的第八篇,主要讲解商户如何处理微信申请退款、退款回调、查询退款接口,其中有一些坑的地方,会着重强调。 浅析微信支付系列已经更新七篇了哟~,没有看过的朋友们可以看一下哦。 浅析微信…

view工作原理-计算视图大小的过程(onMeasure)

view的视图有两种情况: 内容型视图:由视图的内容决定其大小。图形型视图:父视图为view动态调整大小。 ### measure的本质 把视图布局使用的“相对值”转化成具体值的过程,即把WRAP_CONTENT,MATCH_PARENT转化为具体的值。 measur…

基于Redis实现分布式锁实战

背景在很多互联网产品应用中,有些场景需要加锁处理,比如:秒杀,全局递增ID,楼层生成等等。大部分的解决方案是基于DB实现的,Redis为单进程单线程模式,采用队列模式将并发访问变成串行访问&#x…

数据分析 绩效_如何在绩效改善中使用数据分析

数据分析 绩效Imagine you need to do a bank transaction, but the website is so slow. The page takes so much time to load, all you can see is a blue circle.想象您需要进行银行交易,但是网站是如此缓慢。 该页面需要花费很多时间来加载,您只能看…

隐私策略_隐私图标

隐私策略During its 2020 Worldwide Developers Conference, Apple spent time on one of today’s hottest topics — privacy. During the past couple of years, Apple has been rolling out various public campaigns aiming to position itself as a company that respect…

您一直在寻找5+个简单的一线工具来提升Python可视化效果

Insightful and aesthetic visualizations don’t have to be a pain to create. This article will prevent 5 simple one-liners you can add to your code to increase its style and informational value.富有洞察力和美学的可视化不必费心创建。 本文将防止您添加到代码中…

figma 安装插件_彩色滤光片Figma插件,用于色盲

figma 安装插件So as a UX Designer, it is important to design with disabilities in mind. One of these is color blindness. It is important to make sure important information on your product is legible to everyone. This is why I like using this tool:因此&…

产品观念:更好的捕鼠器_故事很重要:为什么您需要成为更好的讲故事的人

产品观念:更好的捕鼠器重点 (Top highlight)Telling a compelling story helps you get your point across effectively else you get lost in translation.讲一个引人入胜的故事可以帮助您有效地传达观点,否则您会迷失在翻译中。 Great stories happen…

7月15号day7总结

今天复习了springMVC的框架搭建。 思维导图: 转载于:https://www.cnblogs.com/kangy123/p/9315919.html

设计师的10种范式转变

For $250, a business can pay a graphic designer to create a logo for their business. Or, for $10,000 a business can hire a graphic designer to form a design strategy that contextually places the business’s branding in a stronghold against the market it’s…

面向Tableau开发人员的Python简要介绍(第2部分)

用PYTHON探索数据 (EXPLORING DATA WITH PYTHON) And we’re back! Let’s pick up where we left off in the first article of this series and use the visual we built there as a starting point.我们回来了! 让我们从在本系列的第一篇文章中停下来的地方开始&…

设计组合中的10个严重错误可能会导致您丧命

As an agency co-founder and design lead, I’ve been participating in many recruitment processes. I’ve seen hundreds of portfolios and CVs of aspiring designers. If you’re applying for a UI designer position, it is good to have some things in mind and to …

MySQL命令学习

上面两篇博客讲了MySQL的安装、登录,密码重置,为接下来的MySQL命令学习做好了准备,现在开启MySQL命令学习之旅吧。 首先打开CMD,输入命令:mysql -u root -p 登录MySQL。 注意:MySQL命令终止符为分号 (;) …