日期:2014-05-16  浏览次数:20898 次

windows noinstall安装配置mysql5.5

1.首先获取mysql5.5,下载社区版,免费。

? mysql5.5的现在地址?http://dev.mysql.com/downloads/mysql/5.5.html#downloads

??mysql5.5_noinstall_32位的下载地址:http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34-win32.zip

? ?mysql5.5_noinstall_64位的下载地址:http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34-winx64.zip

?

2.开始安装

? 把mysql-5.5.34-winx64.zip解压缩到C盘,并把mysql-5.5.34-winx64重命名mysql,复制my-medium.ini为my.ini,修改my.ini,在[mysqld]下面增加:??

basedir=C:/mysql
datadir=C:/mysql/data

?

?

? 把mysql加入环境变量,这一步可以不做,只是为了以后在任意路径下都可以登陆mysql。

??新增加环境变量:

MYSQL_HOME=C:\mysql

?修改PATH环境变量,在最前面增加,注意最后面的英文字符";":

%MYSQL_HOME%\bin;

?3.安装服务

C:\mysql\bin>mysqld --install mysql --defaults-file="c:\mysql\my.ini"
Service successfully installed.

? ?如果需要删除mysql服务,命令如下:

C:\mysql\bin>mysqld -remove mysql
Service successfully removed.

?4.启动与停止

? 可以直接开始-》运行-》输入如下命令回车:

?

net start mysql

? 同样停止mysql服务,开始-》运行-》输入如下命令回车:

?

net stop mysql

?5.初始化数据库

? C:\>mysql -uroot -p 回车,要求输入密码,直接回车继续。

?

C:\>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.34-log MySQL Community Server (GPL)

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

?

更改root的密码为root:

?

mysql> use mysql;#使用mysql这个数据库
Database changed
mysql> update user set password=password("root") where user="root";#更改root账号的密码为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> exit #退出mysql
Bye

? 重新登陆:

?

C:\>mysql -uroot -p
Enter password: **** #输入新密码root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.34-log MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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.乱码问题

? ?登录mysql查看编码:

??SHOW VARIABLES