mysql使用教程windows_MySQL-5.5.23 在Windows上的安装及使用( MySQL简明教程)

1、下载安装

去官网或其他软件站点下最新的即可,我下的32bit的:mysql-5.5.23-win32.msi,大小是31.1MB的,和官网一致。

我的安装目录是:D:\Program Files\MySQL Server 5.5 ,以下命令啥的,都是以这个路径为基准,请使用时根据实际情况定义。

2、启动服务

打开cmd命令行(有时候在cmd下输入mysqld无法启动服务,就自己进到bin目录下,双击这个exe吧):

————————————————————————————————————————

D:\Program Files\MySQL Server 5.5\bin>mysqld

D:\Program Files\MySQL Server 5.5\bin>mysql -uroot -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.23 MySQL Community Server (GPL)

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

————————————————————————————————————————

默认密码是空,直接按回车即可。

3、修改密码

cmd:

D:\Program Files\MySQL Server 5.5\bin>mysqladmin -u root -p  password

Enter password:

New password: ********

Confirm new password: ********

输入root的空密码,即按回车,然后输入新的密码即可。

4、新建用户

新建一个名为test的用户,只允许在本机登录,拥有查、插、改、删的权限,密码为password:

mysql> grant select,insert,update,delete on mydb.* to test identified by "password";

Query OK, 0 rows affected (0.00 sec)

5、显示数据列表

默认如下:

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

+--------------------+

3 rows in set (0.00 sec)

使用其中的mysql:

mysql> use mysql;

Database changed

mysql> show tables;

+---------------------------+

| Tables_in_mysql           |

+---------------------------+

| columns_priv              |

| db                        |

| event                     |

……省略……

| user                      |

+---------------------------+

24 rows in set (0.00 sec)

6、显示数据表的结构

mysql> describe db;

+-----------------------+---------------+------+-----+---------+-------+

| Field                 | Type          | Null | Key | Default | Extra |

+-----------------------+---------------+------+-----+---------+-------+

| Host                  | char(60)      | NO   | PRI |         |       |

| Db                    | char(64)      | NO   | PRI |         |       |

| User                  | char(16)      | NO   | PRI |         |       |

……省略……

| Trigger_priv          | enum('N','Y') | NO   |     | N       |       |

+-----------------------+---------------+------+-----+---------+-------+

22 rows in set (0.00 sec)

7、建库

create database 数据库名;

8、建表

use 数据库名;

create table 表名 (字段设定列表);

9、删库和删表

drop database 数据库名;

drop table 表名;

10、将表中记录清空

delete from 表名;

11、显示表中的所有记录

select * from 表名;

12、管理数据库

需将其存放到apache的服务目录下,然后修改\phpMyAdmin\libraries\config.default.php文件,将215行的$cfg['Servers'][$i]['password'] = 'password';修改成实际的密码,如果mysql用户名有变化,在208行的内容也修改成相应的即可。

13、其他

当然也可以通过打开安装路径bin目录下的:MySQLInstanceConfig.exe工具来配置具体选项咯。

标题是一个链接,点击即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值