mysql-5.6.24-win32.zip 下载 安装 配置 创建数据库
1.mysql-5.6.24-win32.zip下载 安装
MySQL官网 点击Downloads(GA)下面的MySQL Server 进入下载页面。
2.选择Windows 32位。
3.下载文件mysql-5.6.24-win32.zip,解压到目录F:\mysql-5.6.24-win32
4.复制my-default.ini 重命名为my.nin
4.1 my-default.ini文件内容为
4.2 my.ini更改为如下内容
[client]
port=3306
default-character-set=utf8
#客户端字符类型,与服务端一致,建议utf8
[mysqld]
port=3306
character_set_server=utf8
#服务端字符类型,建议utf8
basedir=F:\mysql-5.6.24-win32
#解压根目录
datadir=F:\mysql-5.6.24-win32\data
#解压根目录\data
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[WinMySQLAdmin]
F:\mysql-5.6.24-win32\bin\mysqld.exe
#解压根目录\bin\mysqld.exe
4.3 my.ini配置信息说明
[client]
default-character-set=utf8 客户端编码方式
basedir 安装目录
datadir 数据文件存放目录
port 端口
5.运行cmd安装运行MySQL
5.1 开始——运行——cmd 进入安装目录 F:\mysql-5.6.24-win32\bin
运行mysqld -install,提示安装成功。我的已经安装过所以提示The service already exists!
net start mysql启动MySQL服务
C:\Windows\system32>cd\
C:\>f:
F:\>cd F:\mysql-5.6.24-win32
F:\mysql-5.6.24-win32>cd bin
F:\mysql-5.6.24-win32\bin>mysqld -install
Service successfully installed.
F:\mysql-5.6.24-win32\bin>net start mysql
MySQL 服务正在启动 ...
MySQL 服务已经启动成功。
5.2 修改root密码,初始root密码为空,mysql -u root -p 密码为空。show databases;显示所有表。
use mysql;切换到mysql。进入mysql输入命令以分号结束。
F:\mysql-5.6.24-win32\bin>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.01 sec)
mysql> use mysql
Database changed
5.3 修改root密码为123456
mysql>delete from User where User="";
mysql>update User set Password=PASSWORD('newpassword') where User='root';
mysql>FLUSH PRIVILEGES;
mysql>quit;
FLUSH PRIVILEGES:强制让MySQL重新加载权限,即刻生效
此时登录时可用如下命令:
D:\wamp\mysql\bin>mysql -u root -p
ENTERPASSWORD:newpassword
mysql> delete from User where User="";
Query OK, 1 row affected (0.00 sec)
mysql> update User set Password=PASSWORD('123456') where User='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
F:\mysql-5.6.24-win32\bin>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.6.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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>
6 创建数据库
6.1 创建一个以feng命名的数据库,编码规则为utf8.进入数据库使用use+数据库名称。
mysql> create database feng character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> use feng
Database changed
mysql>
6.2 创建数据库表create table 表名称(列声明)
创建一个students表,表中存放学号(id)名字(name)性别(sex)年龄(age)电话(tel)
通过文本编辑器保存为createtable.sql文件,通过命令提示符下的文件重定向执行该脚本,
6.3 将students表保存到feng数据库
F:\mysql-5.6.24-win32\bin>mysql -D feng -u root -p < C:\Users\Administrator\Desk
top\createtable.sql
Enter password: ******
F:\mysql-5.6.24-win32\bin>
id 列的名称
int (-8388608~8388607)
int unsigned (16777125)
not null 说明该列的值不能为空
auto_increment 在整数列中使用,插入数据时若该列为null,MySQL为自动生成一个比现存值更大的唯一标识符值。
primary key 表明该列是表的主键
char(8) 字符长度为8
tinyint 取值范围为(-127~128)
6.4 查询表信息,show tables; describe students;
mysql> show tables;
+----------------+
| Tables_in_feng |
+----------------+
| students |
+----------------+
1 row in set (0.31 sec)
mysql> describe students;
+-------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | char(8) | NO | | NULL | |
| sex | char(4) | NO | | NULL | |
| age | tinyint(3) unsigned | NO | | NULL | |
| tel | char(13) | YES | | _ | |
+-------+---------------------+------+-----+---------+----------------+
5 rows in set (0.20 sec)
mysql>
7 向表中插入数据
7.1 insert into 表名 (列表1,列表2,列表3,...)values (值1,值2,值3,...);
mysql> insert into students (id,name,sex,age,tel) values (null,"天天","女","23",
"15623458765");
Query OK, 1 row affected (0.00 s)
insert into students values(NULL, "王刚", "男", 20, "13811371377");
7.2 查询表中数据
select 列名称 from 表名称 [查询条件]
查询students表中所有学生名字和年龄
mysql> select name,age from students;
+-----------+-----+
| name | age |
+-----------+-----+
| 王刚 | 20 |
| 孙丽华 | 21 |
| 王杰 | 21 |
| 孙丽华 | 21 |
| 问我 | 21 |
| 问我 | 21 |
| 天天 | 23 |
+-----------+-----+
7 rows in set (0.00 sec)
7.3 按特定条件查询
select 列名称 from 表名称 where 条件,查询所有性别为女的信息。
mysql> select * from students where sex="女";
+----+-----------+-----+-----+-------------+
| id | name | sex | age | tel |
+----+-----------+-----+-----+-------------+
| 2 | 孙丽华 | 女 | 21 | _ |
| 3 | 王杰 | 女 | 21 | 14523456789 |
| 4 | 孙丽华 | 女 | 21 | _ |
| 5 | 问我 | 女 | 21 | _ |
| 6 | 问我 | 女 | 21 | _ |
| 7 | 天天 | 女 | 23 | 15623458765 |
+----+-----------+-----+-----+-------------+
6 rows in set (0.00 sec)
where 列名=值
比较运算符 =,>,<,<=,!=
扩展运算符 is [not] null in like or and
mysql> select * from students where age<23;
+----+-----------+-----+-----+-------------+
| id | name | sex | age | tel |
+----+-----------+-----+-----+-------------+
| 1 | 王刚 | 男 | 20 | 13811371377 |
| 2 | 孙丽华 | 女 | 21 | _ |
| 3 | 王杰 | 女 | 21 | 14523456789 |
| 4 | 孙丽华 | 女 | 21 | _ |
| 5 | 问我 | 女 | 21 | _ |
| 6 | 问我 | 女 | 21 | _ |
+----+-----------+-----+-----+-------------+
6 rows in set (0.00 sec)
mysql> select * from students where name like "%王%";
+----+--------+-----+-----+-------------+
| id | name | sex | age | tel |
+----+--------+-----+-----+-------------+
| 1 | 王刚 | 男 | 20 | 13811371377 |
| 3 | 王杰 | 女 | 21 | 14523456789 |
+----+--------+-----+-----+-------------+
2 rows in set (0.03 sec)
mysql> select * from students where id<5 and age>20;
+----+-----------+-----+-----+-------------+
| id | name | sex | age | tel |
+----+-----------+-----+-----+-------------+
| 2 | 孙丽华 | 女 | 21 | _ |
| 3 | 王杰 | 女 | 21 | 14523456789 |
| 4 | 孙丽华 | 女 | 21 | _ |
+----+-----------+-----+-----+-------------+
3 rows in set (0.04 sec)
7.4 更新表中数据update 表名称 set 列名称=值 where 条件。
mysql> update students set tel=default where id=5;
Query OK, 0 rows affected (0.06 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> update students set tel=default where id=5;
Query OK, 0 rows affected (0.06 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> update students set age=age+1;
Query OK, 7 rows affected (0.05 sec)
Rows matched: 7 Changed: 7 Warnings: 0
mysql> update students set name="华" ,age=19 where tel="14523456789";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
7.5 删除表中数据
delete from 表数据 where 条件
mysql> delete from students where id=1;
Query OK, 1 row affected (0.04 sec)
转载于:https://blog.51cto.com/nickboot/1655916
mysql-5.6.24-win32.zip 下载 安装 配置 创建数据库相关推荐
- Mysql最新版8.0.21下载安装配置教程
一.下载 1.下载安装包 mysql下载路径:https://dev.mysql.com/downloads/file/?id=496745 2.解压压缩包 解压到安装的目录: 3.在此目录下新建my ...
- mysql zip win10安装_mysql 8.0.16 Win10 zip版本安装配置图文教程
本文为大家分享了mysql 8.0.16 Win10 zip版本安装配置图文教程,供大家参考,具体内容如下 首先去mysql官网下载mysql最新版本 1.选择如图所示 community 2.点击 ...
- 新版mysql的下载教程_Mysql最新版8.0.21下载安装配置教程详解
一.下载 1.下载安装包 mysql下载路径:https://dev.mysql.com/downloads/file/?id=496745 2.解压压缩包 解压到安装的目录: 3.在此目录下新建my ...
- MySQL 5.7.21详细下载安装配置教程
MySQL 5.7.21详细下载安装配置教程 前言 在安装MySQL的时候会遇到很多问题,博客上有很多解决问题的办法,在这里我附上一些链接,遇到问题的朋友们可以阅读参考哈~本文主要针对于刚接触数据库的 ...
- mysql 5.720安装_MySQL 5.7.27下载安装配置的详细教程
前言 在安装MySQL的时候会遇到很多问题,博客上有很多解决问题的办法,在这里我附上一些链接,遇到问题的朋友们可以阅读参考哈~本文主要针对于刚接触数据库的小白,来安装MySQL数据库.目前官网上的My ...
- Mysql免安装版(zip)安装配置教程
解决:net start mysql 发生系统错误2 系统找不到指定的文件 本文为大家分享了MySQL免安装版(zip)安装配置教程,供大家参考,具体内容如下 一.MySQL下载地址:https:// ...
- MySQL命令行下载安装配置——详细教程
安装一定要装在C盘,下载别的盘可能不好使 文章目录 免安装版的MySQL MySQL命令行下载 1.打开官网下载 2.点击 MySQL Community Server 3.选择适合的版本 MySQL ...
- mysql5.6.37驱动_mysql 5.6.37(zip)下载安装配置图文教程
本文为大家分享了mysql 5.6.37 下载安装配置教程,供大家参考,具体内容如下 1.下载地址 2.下载完成之后解压缩,移动至安装目录下,建议重命名为:mysql server 5.6,我的安装目 ...
- mysql 5.5.29 winx64_【转载】MySQL 5.7.29详细下载安装配置教程winx64
版权声明:本文为CSDN博主「liu_dong_mei_mei」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明. 原文链接:https://blog.csdn.n ...
最新文章
- android 百度移动搜索 url 参数,百度刷站内快排算法参数-百度搜索URL参数比较详解...
- 【无码专区13】最小公倍数(线段树)
- LeetCode - Easy - 169. Majority Element
- Python语法糖——遍历列表时删除元素
- MATLAB gui 绘图设置
- 2019最新资料!共7T
- 苹果鼠标驱动_EFI引导目录drivers64UEFI文件夹(.efi)文件驱动介绍
- kvaser怎么用?Kvaser 汽车CAN通讯协议总线分析仪新手入门常见问题解决方案教程
- 高等数学---第八章多元函数微分学---多元函数的极值与最值
- Windows命令行计算文件MD5
- vue-pdf插件不翻页预览
- 南京美食指南(完美篇)
- 流氓软件“实名制” 午夜影院乔装正规军
- 大数据如何助力“驯服”火灾?
- 程序设计c语言复试,c语言面试编程题
- [VisionPro] - [异常] - 获取相机列表失败
- 【极简版GH60】【GH60剖析】【七】分析源代码
- 如何检查QFN封装焊接是否正确
- 银河证券互联网转型调研报告:数字化加速器助推银河战舰腾飞
- 一个月的时间戳是多少?
热门文章
- java main方法static_在java中为什么要把main方法定义为一个static方法?
- python 组合数_python – 查找两个数组元素的最大有效组合数
- php server phpself,nginx中的PATH_INFO为什么会影响$_SERVIER['PHP_SELF']
- android开不了机怎么办手机号码,手机开不了机怎么办 原因分析及其解决方法
- iframe给php传值,向iframe传递参数
- 深入浅出mysql gtid_Mysql 5.7 Gtid内部学习(九) 实际案例(一)
- gitlab root
- setuptools setup()
- opencv 图像分割-分水岭算法
- Pandas Index 转换排序联表选取