mysql解压版安装步骤
1.下载mysql-noinstall-5.1.50-win32.zip,解压到E盘(E:\mysql-5.1.50-win32)。
2.复制my-huge.ini为my.ini。
3.修改my.ini,在[client]、[mysqld]、[mysql]后面加default-character-set = utf8,在[mysqld]下加,basedir、datadir。
[client]
default-character-set = utf8
[mysqld]
default-character-set = utf8
default-collation=utf8_bin
init_connect='SET NAMES utf8'
basedir=E:\mysql-5.1.50-win32\ //?此处两目录需指向安装目录
datadir=E:\mysql-5.1.50-win32\data\ // 此处两目录需指向安装目录
[mysql]
default-character-set=utf8
?
4.安装mysql服务。(移除mysql服务mysqld --remove)
命令行下进入E:\mysql-5.1.50-win32\bin,运行mysqld --install mysql --defaults-file="E:\mysql-5.1.50-win32\my.ini"。
E:\mysql-5.1.50-win32\bin>mysqld --install mysql --defaults-file="E:\mysql-5.1.50-win32\my.ini"
Service successfully installed.
注:要加参数安装,不然mysql administrator启动时将提示:
Either
the server service or the configuration file could not be found.Startup
variable and service section are there for disabled.
进入后提示:
This section is only avaliable when connected to localhost
?
5.启动mysql服务.(停止mysql服务net stop mysql)
E:\mysql-5.1.50-win32\bin>net start mysql
mysql 服务正在启动 .
mysql 服务已经启动成功。
?
6.进入mysql,并给MYSQL的root用户加密码。
E:\mysql-5.1.50-win32\bin>mysql -uroot -p
Enter password:
此时密码为空,提示输入密码,直接回车。
E:\mysql-5.1.50-win32\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.1.39-community-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases; #显示所有数据库
+--------------------+
| Database?????????? |
+--------------------+
| information_schema |
| mysql????????????? |
| test?????????????? |
+--------------------+
3 rows in set (0.02 sec)
mysql> use mysql; #切换进mysql数据库
Database changed
mysql> show tables;#显示mysql数据库中所有表
。
+---------------------------+
| Tables_in_mysql?????????? |
+---------------------------+
| columns_priv????????????? |
| db??????????????????????? |
| event???????????????????? |
| func????????????????????? |
| general_log?????????????? |
| help_category???????????? |
| help_keyword????????????? |
| help_relation???????????? |
| help_topic??????????????? |
| host????????????????????? |
| ndb_binlog_index????????? |
| plugin??????????????????? |
| proc????????????????????? |
| procs_priv??????????????? |
| servers?????????????????? |
| slow_log????????????????? |
| tables_priv?????????????? |
| time_zone???????????????? |
| time_zone_leap_second???? |
| time_zone_name??????????? |
| time_zone_transition????? |
| time_zone_transition_type |
| user????????????????????? |
| user_info???????????????? |
+---------------------------+
24 rows in set (0.09 sec)
mysql> #更新mysql数据库中,user表中的root用户密码为wheat;
mysql> update user set password=PASSWORD("wheat") where User='root';
Query OK, 0 rows affected (0.06 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> flush privileges;#更新MySQL的权限表,使刚才的密码更改生效.也可以重启mysql服务.
Query OK, 0 rows affected (0.02 sec)
mysql> exit;#退出