投稿    登录
  《Python3网络爬虫开发实战》赠书活动正在进行中!详情请戳赠书活动!欢迎参与!非常感谢!

[Python3网络爬虫开发实战] 1.4.1-MySQL的安装

Python 崔庆才 9300浏览 14评论

MySQL是一个轻量级的关系型数据库,本节中我们来了解下它的安装方式。

1. 相关链接

2. Windows下的安装

对于Windows来说,可以直接在百度软件中心搜索MySQL,下载其提供的MySQL安装包,速度还是比较快的。

当然,最安全稳妥的方式是直接到官网下载安装包进行安装,但是这样做有个缺点,那就是需要登录才可以下载,而且速度不快。

下载完成后,双击安装包即可安装,这里直接选择默认选项,点击Next按钮安装即可。这里需要记住图1-27所设置的密码。

图1-27 设置密码页面

安装完成后,我们可以在“计算机”→“管理”→“服务”页面开启和关闭MySQL服务,如图1-28所示。

图1-28 系统服务页面

如果启动了MySQL服务,就可以使用它来存储数据了。

3. Linux下的安装

下面我们仍然分平台来介绍。

Ubuntu、Debian和Deepin

在Ubuntu、Debian和Deepin系统中,我们直接使用apt-get命令即可安装MySQL:

在安装过程中,会提示输入用户名和密码,输入后等待片刻即可完成安装。

启动、关闭和重启MySQL服务的命令如下:

CentOS和Red Hat

这里以MySQL 5.6的Yum源为例来说明(如果需要更高版本,可以另寻),安装命令如下:

运行如上命令即可完成安装,初始密码为空。接下来,需要启动MySQL服务。

启动MySQL服务的命令如下:

停止、重启MySQL服务的命令如下:

上面我们完成了Linux下MySQL的安装,之后可以修改密码,此时可以执行如下命令:

输入密码后,进入MySQL命令行模式,接着输入如下命令:

其中newpass为修改的新的MySQL密码,请自行替换。

由于Linux一般会作为服务器使用,为了使MySQL可以被远程访问,我们需要修改MySQL的配置文件,配置文件的路径一般为/etc/mysql/my.cnf。

比如,使用vi进行修改的命令如下:

取消此行的注释如下:

此行限制了MySQL只能本地访问而不能远程访问,取消注释即可解除此限制。

修改完成后重启MySQL服务,此时MySQL就可以被远程访问了。

到此为止,在Linux下安装MySQL的过程就结束了。

4. Mac下的安装

这里推荐使用Homebrew安装,直接执行brew命令即可:

启动、停止和重启MySQL服务的命令如下:

Mac一般不会作为服务器使用,如果想取消本地host绑定,那么需要修改my.cnf 文件,然后重启服务。

转载请注明:静觅 » [Python3网络爬虫开发实战] 1.4.1-MySQL的安装

喜欢 (5)or分享 (0)

我的个人微信公众号,联系我请直接在公众号留言即可~

扫码或搜索:进击的Coder

进击的Coder

微信公众号 扫一扫关注

想结交更多的朋友吗?

来进击的Coder瞧瞧吧

进击的Coder

QQ群号 99350970 立即加入

进击的Coder灌水太多?

这里是纯粹的技术领地

激进的Coder

QQ群号 627725766 立即加入

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请狠狠点击下面的

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(14)个小伙伴在吐槽
  1. Please stop by the sites we adhere to, which includes this one, as it represents our picks from the web.
    Google2019-01-15 06:23 (1天前)回复
  2. Sites of interest we've a link to.
    Google2019-01-12 10:16 (4天前)回复
  3. This is really interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your excellent post. Also, I've shared your website in my social networks!
    descargar facebook2018-12-05 01:02 回复
  4. Greetings from Florida! I'm bored to death at work so I decided to check out your website on my iphone during lunch break. I love the knowledge you provide here and can't wait to take a look when I get home. I'm surprised at how fast your blog loaded on my cell phone .. I'm not even using WIFI, just 3G .. Anyhow, superb blog!
    descargar facebook2018-11-23 02:26 回复
  5. I like the valuable info you provide in your articles. I'll bookmark your weblog and check again here frequently. I am quite sure I will learn plenty of new stuff right here! Good luck for the next!
  6. Keep this going please, great job!
  7. Sling tv coupons and promo codes for november 2018 Paragraph writing is also a fun, if you be familiar with afterward you can write if not it is complex to write. Sling tv coupons and promo codes for november 2018
  8. Unquestionably believe that that you stated. Your favourite reason appeared to be at the net the easiest thing to remember of. I say to you, I certainly get irked even as other folks think about worries that they plainly do not know about. You controlled to hit the nail upon the top and outlined out the entire thing without having side-effects , folks can take a signal. Will probably be again to get more. Thanks
  9. Hello, Neat post. There is an issue together with your site in internet explorer, may test this? IE still is the market leader and a huge component to other people will omit your wonderful writing due to this problem.
    Sling TV2018-11-15 10:14 回复
  10. What's up, I read your blogs regularly. Your humoristic style is witty, keep it up!
  11. Fantastic site you have here but I was wondering if you knew of any community forums that cover the same topics talked about in this article? I'd really love to be a part of community where I can get comments from other knowledgeable people that share the same interest. If you have any recommendations, please let me know. Thanks a lot!
    quest bars2018-11-07 01:22 回复
  12. I seriously love your blog.. Very nice colors & theme. Did you make this website yourself? Please reply back as I'm hoping to create my own blog and would like to find out where you got this from or exactly what the theme is named. Thank you!
    quest bars cheap2018-11-04 23:45 回复
  13. Attractive element of content. I just stumbled upon your website and in accession capital to say that I acquire in fact loved account your weblog posts. Anyway I'll be subscribing to your augment and even I fulfillment you access consistently quickly.
    quest bars cheap2018-11-03 20:27 回复
  14. The other day, while I was at work, my cousin stole my apple ipad and tested to see if it can survive a thirty foot drop, just so she can be a youtube sensation. My apple ipad is now destroyed and she has 83 views. I know this is totally off topic but I had to share it with someone!
    Coconut Oil2018-10-25 20:43 回复