mysql学习笔记

 

前言

  做了那么久的终端开发,经过跟同事的交流,发觉数据库方面的短板越来越影响到了后续的发展,温习一下以前学过的一些sql相关知识。

首先从安装开始。一开始去官网下载了最新版本5.7.17,经过昨天到今天的折腾,度娘上也找了不少前辈的攻略,最后仍然失败。

解压版卡在mysqld –install这一步,老是提示0x000000007这么一个错误。

安装版本卡在启动服务的位置,老是提示:

开始启动服务,

服务无法启动

查log,显示错误:

2017-10-01T09:00:42.847997Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-10-01T09:00:42.847997Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2017-10-01T09:00:47.277250Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-10-01T09:00:47.917287Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-10-01T09:00:48.213304Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 045da655-a687-11e7-8e7f-00ff4820d3b6.
2017-10-01T09:00:48.257306Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-10-01T09:00:48.399314Z 1 [Note] A temporary password is generated for root@localhost: AwVkHAXWW8=P

 

浪费了两天时间之后,暂停这个版本。

重新选择官网老版本,正常流程安装,一遍搞定,出乎意料的顺利,输入密码,马上就出现了正常使用界面,从安装到使用十分钟都不到,简直让我无话可说,几年没有接触就落后这么远了?????

 

熟悉了几天mysql之后,开始折腾python,需要安装匹配python2.7的mysql版本。按照一个博客的方法,下载MySQL-python-1.2.3,手动安装,出现问题如下:

暂时没解决,先放着。。。。。。。(后来发现修改 setup_windows.py文件可以解决这个问题,但是有其他问题,而且用pip方式安装已经ok了就没有继续研究下去)

 

转为pip方式安装,提示如下错误:

 error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27

处理方式,准备安装VC:Microsoft Visual C++ Compiler for Python 2.7,     https://www.microsoft.com/en-us/download/details.aspx?id=44266

然后继续安装,出现以下错误:

fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory

解决方法:

在http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python下载对应的包版本,我是win7 64位的python,故下载MySQL_python-1.2.5-cp27-none-win_amd64.whl

 然后用pip命令安装,最后再重新安装mysql:pip install mysql,终于成功。

 pip方式的一些问题解决方式参考如下:http://blog.csdn.net/u012882134/article/details/51934165

 

 

 

 另外一台电脑的安装记录: win10+amd64位python27+mysql5.6.31

已安装好python,开始安装pip:
解压pip安装包,cd到解压目录,W:\learn_for_test\pip-9.0.1\pip-9.0.1,输入 python setup.py install

安装mysqldb,
pip install MySQL-python
报错报错如下:error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

安装 VCForPython27.msi,之后继续pip命令安装,出现以下错误:
_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
尝试安装 mysql-connector-c-6.1.11-winx64.msi,没有效果,尝试查看是否确实缺少config-win.h文件
电脑安装mysql,mysql-installer-community-5.6.31.0.msi
然后继续 pip安装,成功。用pip命令查看安装的包:pip list
出现了MySQL-python (1.2.5),说明已经安装成功。
在命令行验证,
>>> import MySQLdb
>>> print MySQLdb
出现以下文字,说明已经完全搞定。
<module 'MySQLdb' from 'C:\Python27\lib\site-packages\MySQLdb\__init__.pyc'>

 

         

 

posted on 2017-10-01 21:36  sim_lq  阅读(354)  评论(0编辑  收藏  举报

导航