64位windows下mysql安装

  登入mysql官网https://www.mysql.com/downloads/,点击Community,选择MySQL on Windows,选择MySQL Installer,选择MySQL Server,然后选择自己喜欢的mysql版本。我选择5.6版本(MySQL Community Server 5.6 »),然后选择小版本,我就选择最新的5.6.38下载了。别忘了选择操作系统,在Select OS Version下拉框里选择Windows(x86,64-bit)。

  我们直接下windows的MSI安装文件,选择对应的图片后跳出下载页。这个页面提示我们说,64位跟32位其实是同一个安装包。好吧,再次点击DownLoad按钮下载,再跳出一个页面来,不管上面的注册和登陆,直接点最下面的No thanks, just start my download.。至此,九弯十八曲,我们拐了好几个页面终于下到了安装包。下一步就是运行安装包执行安装程序。

  执行安装程序后按部就班走,第一步签合同,第二步选安装类型,我按默认的来,第三步先检查后安装,检查的话检查一项就可以了,不检查直接跳过到安装也行,接着一项项安装,第四步配置数据库,一直点过去就可以了,中间设置下密码即可(默认用户是root,默认端口3306)。

  最后Finish出来表示按流程走完了安装程序,跳出一个MySQL workbench的界面,输入密码登录就可以玩MySQL了。

  如果下载的是压缩包,会麻烦一点,需要手动配置系统路径、修改密码。首先解压后把bin目录所在路径配置到系统路径Path中(比如我本地是:D:\Dev\mysql\mysql-5.7.26-winx64\bin),接着用管理员身份运行命令行界面,再次来到mysql目录下(比如我本地是D盘的mysql\mysql-5.7.26-winx64 ),通过命令执行安装和启动:

C:\WINDOWS\system32>D:

D:\>cd Dev\mysql\mysql-5.7.26-winx64

D:\Dev\mysql\mysql-5.7.26-winx64>mysqld -install
Service successfully installed.

D:\Dev\mysql\mysql-5.7.26-winx64>mysqld --initialize

D:\Dev\mysql\mysql-5.7.26-winx64>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

   这时启动的mysql是自己生成的临时密码,我们应该把它改成自己的密码。首先找到临时密码,还是回到mysql所在目录(比如我本地是D盘的mysql\mysql-5.7.26-winx64)进入data目录,打开XXX.err文件(XXX是你的本机用户名),搜“root@localhost”(root是mysql系统启动默认账户),找到冒号后面的密码,用它即可登录进入mysql:

D:\Dev\mysql\mysql-5.7.26-winx64>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.26

Copyright (c) 2000, 2019, 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:

mysql> set password for root@localhost = password('123456');
Query OK, 0 rows affected, 1 warning (0.07 sec)

mysql> quit
Bye

D:\Dev\mysql\mysql-5.7.26-winx64>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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>

  看下都有哪些库,如果没有test数据库,那么就建一个:

mysql> create database test;
Query OK, 1 row affected (0.02 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
5 rows in set (0.01 sec)

mysql> use test
Database changed
mysql> show tables;
Empty set (0.00 sec)

  如果要停掉mysql执行net stop mysql命令即可。

posted on 2017-12-26 20:58  不想下火车的人  阅读(1244)  评论(0编辑  收藏  举报

导航