MySQL安装

MySQL安装

本教程将介绍如何使用MySQL Installer在Windows平台(Win10)上安装MySQL。在学习并按照本教程所示的步骤操作之后,您将有一个MySQL数据库服务器在您的系统中,并以此MySQL数据库服务器为基础,运行相关工具来学习和实践MySQL。

下载MySQL安装程序

这里想要说的是,安装MySQL的方式有好几种,由于文章篇幅的限制,这里只选定一种作为安装演示。具体的安装,可以按照你喜欢的方式来。只要有两种方式:

  1. 在线安装版,下载:mysql-installer-web-community.exe
  2. 离线安装版,下载:mysql-installer-community.exe
  3. 解压缩版,下载:Windows (x86, 64-bit), ZIP Archive

上面的下载安装程序,可以从网址: http://dev.mysql.com/downloads/mysql/ 找到。

如果要在Windows环境中安装MySQL,使用MySQL安装程序是最简单的方法。MySQL安装程序为您提供了一个易于使用的向导,可帮助您使用以下组件安装MySQL:

  • MySQL服务器
  • 所有可用连接器
  • 具有示例数据模型的MySQL Workbench
  • MySQL通知程序
  • Excel和Microsoft Visual Studio的工具
  • MySQL示例数据库
  • MySQL文档

现在,我们一步步来看,如何下载并安装 MySQL 服务器软件。

第一步:下载所需的安装包

打开网址:http://dev.mysql.com/downloads/mysql/ , 如下所示 –

注:因为在编写本教程时,使用的是Win10 64位的操作系统,所以这里选择:Windows (x86, 64-bit), ZIP Archive 下载

在弹出的第二个页面中,选择点击“No thanks, just start my download.” 跳过注册/登录帐号环节直接下载。如下图所示 –

然后,耐心等待下载完成…

第二步:压缩到指定目录

准备好一个安装 MySQL 程序的目录,如:D:/software

在本教程中,您已经学会了如何使用MySQL安装程序在Windows系统中安装MySQL,下载MySQL示例数据库并将其加载到MySQL服务器中,以通过此MySQL教程练习和学习MySQL。

这里解压后的目录为:D:\software\mysql-5.7.18-winx64 , 此目录下的文件如下所示 –

第三步:启动MySQL服务器

管理员身份打开命令行,进入 MySQL 服务器安装的目录:D:\software\mysql-5.7.18-winx64\bin ,执行以下命令启动 MySQL –

Microsoft Windows [版本 10.0.10586]
(c) 2015 Microsoft Corporation。保留所有权利。
C:\WINDOWS\system32>D:
D:\>cd software\mysql-5.7.18-winx64\bin
D:\software\mysql-5.7.18-winx64\bin>mysqld -install
Service successfully installed.
D:\software\mysql-5.7.18-winx64\bin>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。
D:\software\mysql-5.7.18-winx64\bin>

如果有提示如下错误 –

D:\software\mysql-5.7.18-winx64\bin> mysqld.exe
mysqld: Can't change dir to 'D:\software\mysql-5.7.18-winx64\data' (Errcode: 2 - No such file or directory)
2017-07-14T18:48:51.023897Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
... ...
2017-07-14T18:48:51.039516Z 0 [Note] Binlog end
2017-07-14T18:48:51.039516Z 0 [Note] mysqld.exe: Shutdown complete

上面错误提示中,已经说明了:

mysqld: Can't change dir to 'D:\software\mysql-5.7.18-winx64\data' (Errcode: 2 - No such file or directory)

则需要在创建一个目录:D:\software\mysql-5.7.18-winx64\data\ ,现在我们就来创建这个目录,在创建目录完成后重新执行 mysqld -install 启动 MySQL 服务器 –

一定要注意两个问题,切记!

第一: 以管理员自身份打开CMD;
第二:用cd命令进入到你MySQL文件的解压路径。

第四步:连接MySQL服务器

服务启动成功之后,就可以连接/登录MySQL服务器了,打开命令提交符界面输入mysql -u root -pmysql -h localhost -u root -p(第一次登录没有密码,直接按回车过),登录成功,但是登录成功后,不能执行任何操作,MySQL服务器要求您必须设置密码再执行其它操作。

假设我们登录成功后,要查看当前目录下所数据名称(执行查询:show databases),但它提示要先设置密码。完整的过程如下所示 –

D:\software\mysql-5.7.18-winx64\bin>mysql -hlocalhost -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.9

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.08 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
6 rows in set (0.11 sec)

mysql>

有关解压包安装MySQl服务器就这样完成了~,如果想要使用在线安装的方式来安装MySQL,请参考: http://dev.mysql.com/doc/refman/5.7/en/mysql-installer.html

或者,如果您觉得安装过程比较烦锁,那么可以使用以下在线环境。

MySQL在线环境(免安装)

Mysql是最流行的关系型数据库管理系统,在WEB应用方面MySQL是最好的RDBMS(Relational Database Management System:关系数据库管理系统)应用软件之一。具有免费开源、跨平台、支持多种语言、支持千万级大型记录等特点。下面我将向你介绍如何在 CloudStudio 平台上运行MySql服务,以最小的成本搭建一个MySql数据库。

CloudStudio PHP 开发环境中为我们集成了一个MySql5.7.12的服务端程序,使用起来也非常简单。下面我将叫你如何启动运行它:

  • step1:访问CloudStudio,注册/登录账户。
  • step2:在右侧的运行环境菜单选择:"PHP" 运行环境
  • step3:通过命令: sudo /etc/init.d/mysql start启动MySql服务
  • step4:通过命令:mysql -hlocalhost -uroot -p可以登录mysql服务端,默认密码是coding(我承认我是蒙对的)。

    至此,一个Mysql的服务便启动了!它的配置文件的位置是:/etc/mysql/mysql.conf.d/mysqld.cnf 你可以自己去更改配置。

 

移动端:请扫描本页面底部(右侧)二维码并关注微信公众号,回复:”教程” 选择相关教程阅读

94 Responses

  1. Kwicdf说道:

    order lexapro 20mg naltrexone brand where can i buy revia

  2. Zirjoz说道:

    lasix pills purchase acticlate for sale order albuterol pills

  3. Xotjwh说道:

    brand strattera sertraline 50mg for sale zoloft sale

  4. Hzgtvf说道:

    urso 150mg cost generic actigall cetirizine 10mg uk

  5. Yaghtu说道:

    how to buy zithromax omnacortil 40mg price cheap neurontin generic

  6. Ednfom说道:

    best natural supplements for gerd stomach upset from taking medication best otc med for flatulence

  7. Udpqbb说道:

    brand deltasone 40mg prednisone over the counter amoxil us

  8. Colqcr说道:

    get birth control prescribed online cheapest birth control online how to increase sperm count by food

  9. Zmwcmo说道:

    buy cheap generic promethazine phenergan canada stromectol online canada

  10. Kknbqr说道:

    best antacid for stomach ulcer class ic antiarrhythmics drugs will tylenol help ease uti pain

  11. Luggie说道:

    buy duloxetine 20mg sale order provigil 200mg generic purchase modafinil online

  12. Iftjgn说道:

    vitamins that kill fungus list of medication for hypertension combination blood pressure medications list

  13. Fwzrbk说道:

    can you get valtrex online how is type 2 diagnosed how is type 2 diabetes diagnosed

  14. Pxerjp说道:

    buy generic cyproheptadine buy periactin pill ketoconazole over the counter

  15. Ybamca说道:

    prescription drug for stopping smoking dangers of osteoporosis medications strong prescribed pain killers

  16. Bgolau说道:

    buy medroxyprogesterone pills for sale cost medroxyprogesterone hydrochlorothiazide online

  17. Czjbis说道:

    most potent sleeping pills prescription diet pills without doctor get prescription diet pills online

  18. Lfjefm说道:

    order femara 2.5mg pills buy generic albendazole 400mg cheap aripiprazole 20mg

  19. Rmndym说道:

    alfuzosin 10 mg cost homeopathic medicine for stomach acid heartburn relief without calcium

  20. Judvqg说道:

    buy minocycline medication minocin 100mg cost buy ropinirole for sale

  21. Pmtbkp说道:

    strongest topical body acne medication teenage acne treatments that work buy oxcarbazepine pills

  22. Biicra说道:

    catapres 0.1mg over the counter spiriva 9 mcg ca spiriva 9 mcg oral

  23. Qjbxdj说道:

    calcitriol 0.25mg tablet buy calcitriol 0.25 mg for sale order tricor 160mg sale

  24. Znorcm说道:

    trimox order arimidex 1mg sale biaxin drug

  25. Wbehwn说道:

    essay edit free slots casino games best play money poker sites

  26. Ndqpxt说道:

    online assignment help reflective essay writing 101 suprax 100mg ca

  27. Cybfcs说道:

    aspirin 75mg price legit real money online casinos free casino games no registration no download

  28. Qmylvi说道:

    lamisil cost casino money poker online for real money

  29. Lvkrnp说道:

    oral desyrel 50mg desyrel 100mg uk clindamycin drug

  30. Aczxpx说道:

    axetil us cheap ceftin 500mg buy robaxin online cheap

  31. Swnprx说道:

    tadacip drug diclofenac 50mg over the counter purchase indomethacin pills

  32. Xeiyio说道:

    tamoxifen pills buy tamoxifen cheap budesonide drug

  33. Tjyzkj说道:

    retin for sale tretinoin for sale stendra pill

  34. Ydxoep说道:

    buy generic cleocin order fildena 50mg pills fildena 100mg tablet

  35. Ypnbwp说道:

    lamictal over the counter nemazole over the counter buy vermox for sale

  36. Hkdrzf说道:

    metronidazole 400mg oral keflex generic buy keflex 250mg generic

  37. Tqmnaf说道:

    buy aurogra online cheap purchase estradiol sale buy estrace 1mg without prescription

  38. Tosiqn说道:

    order diflucan 100mg brand ciprofloxacin 500mg order baycip online

  39. Olyivs说道:

    aldactone pills spironolactone where to buy buy propecia 5mg pills

  40. Lillsb说道:

    good academic writing academic writing uk buy an essay online cheap

  41. Hinfkh说道:

    oral domperidone 10mg order motilium 10mg generic buy tetracycline 500mg sale

  42. Jorjun说道:

    buy ranitidine buy celecoxib 100mg online celebrex uk

  43. Mjptla说道:

    buspirone 5mg drug buy generic amiodarone 200mg buy cordarone medication

  44. Kisqae说道:

    sumatriptan oral sumatriptan buy online buy avodart cheap

  45. Bxtllg说道:

    buy generic zyloprim over the counter rosuvastatin 10mg cheap order crestor 20mg

  46. Gqovdr说道:

    oral nexium 20mg topamax 100mg uk topiramate 100mg uk

  47. Zjeyqu说道:

    purchase astelin generic avalide online buy irbesartan sale

  48. Sprxih说道:

    cheap famotidine 20mg order pepcid 40mg for sale order tacrolimus 1mg

  49. Svethe说道:

    buy generic warfarin paxil 20mg generic metoclopramide 10mg brand

  50. Bberan说道:

    buy xenical pill purchase xenical pill diltiazem online order

  51. Fyaudg说道:

    nortriptyline order online order pamelor 25 mg generic panadol sale

  52. Snlwlt说道:

    buy glimepiride medication misoprostol online buy arcoxia 60mg tablet

  53. Vtzcnq说道:

    where to buy propranolol without a prescription buy clopidogrel 150mg generic plavix over the counter

  54. Xyokkt说道:

    buy alendronate generic order nitrofurantoin 100mg online cheap purchase furadantin pill

  55. Wcfrzs说道:

    buy generic ozobax over the counter buy generic baclofen order toradol 10mg online

  56. Pcgnvt说道:

    order claritin 10mg generic priligy 90mg pill priligy drug

  57. Oauboi说道:

    buy generic lioresal online buy cheap lioresal purchase toradol sale

  58. Spctyo说道:

    phenytoin 100 mg tablet oxybutynin sale order ditropan 2.5mg online cheap

  59. Vflmhv说道:

    coversyl uk fexofenadine 180mg usa cheap allegra

  60. Fxyvxj说道:

    levitra 20mg pill buy generic vardenafil for sale zanaflex us

  61. Gcwezp说道:

    buy medrol us aristocort 10mg over the counter aristocort generic

  62. Fyflmd说道:

    serophene tablet isosorbide canada azathioprine 50mg price

  63. Ephwwy说道:

    casino slots free brand levothyroxine levothroid over the counter

  64. Ztwaon说道:

    symmetrel ca order atenolol 100mg generic oral avlosulfon

  65. Gkopql说道:

    play poker online free no sign up play online blackjack ivermectin 2mg online

  66. Vbkoeu说道:

    hollywood casino live dealer blackjack albuterol online

  67. Ulmpjd说道:

    pantoprazole oral lisinopril generic buy pyridium no prescription

  68. Skmpzg说道:

    best casino online no deposit bonus codes lasix 100mg pills

  69. Qxemqp说道:

    azithromycin pills neurontin 800mg cost neurontin 600mg uk

  70. Jzbzgm说道:

    lipitor uk amlodipine 5mg ca order amlodipine 5mg pill

  71. Pichbw说道:

    buy accutane pill order azithromycin for sale order azithromycin 500mg sale

  72. Xtkeyl说道:

    buy cefdinir 300mg order omnicef sale lansoprazole 15mg pills

  73. Ifuhek说道:

    provigil medication order promethazine 25mg generic buy deltasone for sale

  74. Tyhysr说道:

    purchase cenforce buy cenforce sale purchase chloroquine pill

  75. Xjlyiv说道:

    cialis price real viagra 100mg sildenafil 50mg oral

  76. Caroai说道:

    micardis price movfor cheap brand molnunat

  77. Eunoqe说道:

    prilosec cost buy montelukast 10mg without prescription metoprolol over the counter

  78. Ymhegw说道:

    premarin 0.625mg without prescription buy generic premarin online oral sildenafil 50mg

  79. Zjukpu说道:

    order vasotec 5mg sale lactulose oral purchase duphalac without prescription

  80. Joioti说道:

    mestinon 60 mg uk maxalt online buy order maxalt online cheap

  81. Xbxxba说道:

    purchase ferrous sulfate online cheap purchase actonel online buy sotalol generic

  82. Bjfspa说道:

    monograph 600 mg cheap colospa 135mg us order cilostazol online cheap

  83. Vpkrgc说道:

    order prasugrel 10mg order dramamine 50mg detrol pills

  84. Lvqhlb说道:

    buy florinef pills buy aciphex medication buy generic imodium

  85. Sdkymk说道:

    brand dydrogesterone purchase dydrogesterone for sale empagliflozin where to buy

  86. Ghygdr说道:

    order melatonin 3 mg generic buy melatonin online buy danazol sale

  87. Jmaavk说道:

    buy generic dipyridamole for sale order pravastatin sale pravastatin 20mg over the counter

  88. Adoujc说道:

    aspirin order online oral imiquad buy imiquimod for sale

  89. Zfidzw说道:

    buy acarbose 50mg without prescription repaglinide 1mg drug pill fulvicin 250 mg

  90. Fjazzl说道:

    buy minoxidil without a prescription buy cheap generic minoxytop herbal ed pills

  91. Snhdvt说道:

    cialis 10mg without prescription buy cialis 40mg sale viagra 50mg drug

  92. Wcxtyz说道:

    ketotifen 1 mg ca buy zaditor 1 mg generic buy generic tofranil

  93. Qigszj说道:

    where can i buy tricor buy fenofibrate online order tricor generic

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

CAPTCHAis initialing...