安装mysql过程:
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\ // 此处两目录需指向安装目录
[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
[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
命令行下进入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 服务已经启动成功。
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:
此时密码为空,提示输入密码,直接回车。
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)
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)
+--------------------+
| 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 |
+---------------------------+
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 |
| 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)
| 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> 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)
Query OK, 0 rows affected (0.02 sec)
mysql> exit;#退出
安装mysql时路径正确却安装不成功,提示以下
The service already exists!
The current server installed:以前安装mysql的地址/bin/mysqld-nt MYSQL
mysql下载后安装中出现提示不到安装包
解决办法
移除原来的mysql服务
e:
cd E:\JAVA FILES\mysql-5.1.39-win32\bin
mysqld --remove mysql --defaults-file="E:\JAVA FILES\mysql-5.1.39-win32\my.ini"
pause
然后,重新安装一次:
e:
cd E:\JAVA FILES\mysql-5.1.39-win32\bin
mysqld --install mysql --defaults-file="E:\JAVA FILES\mysql-5.1.39-win32\my.ini"
pause
就可以看到安装成功了
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论