1MySQL简介
MySQL是一个关系型数据库管理系统,由瑞典MySQL AB公司开发,目前属于Oracle旗下产品。MySQL所使用的SQL语言是用于访问数据库的最常用标准化语言,MySQL软件采用了双授权政策,分为社区版和商业版,由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,一般中小型网站的开发都选择MySQL作为网站数据库。
2MySQL安装
我是从睿思上下哒:[软件][安装包][oracle][MySQL][5.7.18][英文][免费软件][Windows][x86_64]

安装环境:Windows7 32位
安装版本:mysql-server-5.7.18
安装步骤(可以参考这篇文章:mysql 5.7.13 安装配置方法图文教程(win10) 或这篇 MySQL基础知识-安装MySQL):






强行安装。。。


安装到这一步之后出现了问题,全部都失败了,网上查了一下,发现可能是之前MySQL卸载不干净导致的。现在来把MySQL卸载干净,参考:卸载mysql时,如何卸载干净!
到了这一步还是不行:

OK,我来安装这两个需要的东西。
MySQL for Visual Studio 1.2.7 和 Connector/Python (3.4)2.1.6
2.辅线1 安装 MySQL for Visual Studio 1.2.7(failed)
地址:http://www.3673.com/soft/22167.html
开始安装后显示要卸载其他版本的Visual Studio:

我搜了一下,我电脑上又Visual Studio 2008:

卸载它,参考:如何把VS2008卸载干净 删除VS2008所有的组件
我发现在控制面板的添加与删除程序中找不到它,于是直接在开始菜单中搜索它,找到文件所在位置,将整个文件夹删除掉了。
2019/04/22
我又继续来装软件了。之前问题还是没有解决,一直显示那几个版本的VS还没有删除。
2.辅线2 安装 Visual Studio 2015(success)
在睿思上下了一个vs2015:

注意win7不能直接打开iso的文件,需要右键->打开方式->压缩文件,才可以打开:

双击红框圈出的文件开始解压,解压完之后安装,我是按默认方式安装的。
2019/04/23
昨天安装好了vs,啊啊啊,终于成功了,接下来来解决最后一个小东西:
2.辅线3 安装 Connector/Python(3.4)2.1.6(failed)

上面留了下载地址,我猜问题不大~
我选择了这个版本:

下的介一个:

下载好解压之后发现它的setup文件是py格式的:

用网上查找到的命令执行:

出现这个问题的原因是没有配置环境变量。
因为目录中含有中文字符,为了以防万一我把它移了出来,直接放在d盘中:

配置环境变量:

还是不行。
2.辅线4安装 Python 2.7.10(failed)
在睿思上找了这个资源:

下载。
下好了:

开始安装:





重新配置环境变量:

OK,python命令可以使用了,但是又出现了新的问题:

可是我找到了这个名为machinery.py的模块:

方法一(failed):把它复制到setup.py目录下试试?
试了不行。
方法二(failed):给它添加环境变量?

试了不行。
方法三(failed):打开setup.py文件,找到出错的这一行:

给前面加上Lib:

可是还是错的,o(╥﹏╥)o:

方法四:
我安装的connector/python是3.4的,Python.exe是2.7,可能是因为Python的版本太低了,OK,卸载了重新下。
2.辅线5 安装 Python 3.7.3(failed)
我下了这个:


下好了:

安装:

我勾选了“Add Python 3.7 to PATH”,然后安装:

安装成功:

添加环境变量:

依然不行:

会不会是必须同一个版本的python和.py相对应呢?
话不多说,下载python 3.7.3的.py包:

依然不行。
2.辅线6 安装 Python 3.4.0(failed)
都是在官网上下的:

下的同一个版本的python和setup.py。
安装过程略。
配置环境变量:

依然不行:

很崩溃o(╥﹏╥)o

2.辅线7 安装 Python (3.4)2.1.6(success)
最后解决的方法是,百度搜索:

进入这个链接下载:Python连接MySQL驱动(MySQL Connector/Python) 8.0.11 官方最新版
我安装的是这个版本:

双击后一闪而过。
回到主线:2MySQL安装
再检测就没有那个问题了,之前忽略了这个问题:

继续辅线来解决它。
2.辅线8 安装 MySQL For Excel 1.3.6
这次我聪明了,直接百度:

进入这个链接下载:MySQL for Excel中文版1.3.6 官方版_64位/32位
安装:

???
说明它们是具有相同功能的吗?
那先不管。继续进入主线,进行下一步安装。
回到主线:2MySQL安装 (failed)

希望点击Execute之后都能安装成功吧,哭哭o(╥﹏╥)o好担心。
还是不行,显示它们都下载失败了。
我退出了。
在控制面板中把安装的不成功的东西卸载掉了。
重新打开安装包(唉,不知道这是第多少次重新打开了):

这次界面有点变化(莫名其妙变成自定义安装了):


凭感觉来选:


安装中:

成功了:

next:

next:

next:

next,密码设置的是我的生日:

next:

next:

next,点击Execute:

都配置完后,点击Finish。

next:

next(和教程中的步骤不太一样,教程中后面还有一些配置,我的没有,心里发虚):

验证一下是否安装成功。
打开:

成功了:

希望以后的使用能够顺利,已经累到没有力气说耶了。

2019/04/23晚 再更
安装的不对。卸载掉。
主线:2MySQL安装 (success)
最终还是选择在这里下载(为什么之前都没有注意到,感觉走了好多冤枉路,想哭):

下好了:

开始安装:





选择“现在就配置MySQL”:

开始配置。

我们选择下面的标准配置:


(root密码为我的生日)

点击Execute开始执行:

OK了:

3字符集配置
1)找到my.ini文件,查找default-character-set节点,修改成utf8。
根据上图中的路径找到my.ini文件并修改:

2)继续查找default-character-server节点,修改成utf8。

4MySQL服务启动
右键单击计算机,选择管理。

找到MySQL:

双击进行设置(它已经自动启动啦,这里我们就不用修改了~):

我们也可以在这里右键单击选择“重新启动”:

5MySQL登录
在cmd中输入命令:mysql -u root -p,会提示输入密码,输入正确密码后就登录成功啦:

6MySQL基本操作
1)查看目前mysql用户
select user,host,password from mysql.user
2)修改root密码
set password for root@localhost=password('your password');
set password for root@127.0.0.1=password('your password');
修改完退出mysql重新登录一下哦。
3)退出mysql
exit
4)登录mysql
mysql -u root -p
然后输入密码即可登录成功。
5)删除匿名用户
查看是否有匿名用户:select user,host from mysql.user;
删除匿名用户:delete from mysql.user where user='';
再次查看:select user,host from mysql.user;
刷新,使以上操作生效:flush privileges;
6)插入mysql新用户
insert into mysql.user(Host,User,Password) values("localhost","yourusername",password("yourpassword"));
刷新,使以上操作生效:flush privileges;
7)创建新的database
CREATE DATABASE `mmal` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
上面的`符号是和~同一个键的另一个符号。
8)本地用户赋予所有权限
grant all privileges on mmall.* to yourusername@localhost identified by 'yourpassword';
9)给账号开通外网所有权限
grant all privileges on mmall.* to 'yourusername'@'%' identified by 'yourpassword';
注:根据自己实际情况决定是否开什么权限。
如:grant select,insert,update on mmall.* to yourusername@'192.11.11.11' identified by 'yourpassword';
代表只开通增改查给指定的账号,并也指定ip地址。
7MySQL验证
1)执行ipconfig查看运行mysql服务器的ip地址。

2)通过mysql客户端工具(有很多,这里使用navicat)进行连接。
我在睿思上找了个资源,下载navicat:[软件][exe][PremiumSoft][Navicat Premium][11.2.7][简体中文][商业软件][win][x86_64][附破解]
安装:









破解:
以管理员身份运行注册机。




生成了license_file文件,license_file文件与注册机保存在同一目录下哦:


断开网络,运行Navicat。
将注册机生成的激活码填入:

同时按住Ctrl+Shift键,并点击激活按钮,会弹出文件选择框,选择我们刚刚生成的license_file文件:

激活成功:

安装好就可以开始连接啦:
1.新建连接(除了红框内的内容都是默认生成的)

2.连接测试。
点击左下角的连接测试,显示成功。

3.进入该数据库。

更多关于MySQL的教程可以看这个课程学习:与MySQL的零距离接触
网友评论