http://hi.baidu.com/mvp_xuan/item/5b093c3c5350f4fa96f88dd2 百度空间

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、管理数据库

   下载:phpMyAdmin 3.5.0并安装;

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

   访问其:打开apache服务,通过IE访问:http://localhost/phpMyAdmin/index.php 即可。


13、其他

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


14、PHP5.4 for Apache ; php 5.4.0安装过程、方法、配置 ; Apache2.2支持php5.4的配置方法

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