admin 管理员组

文章数量: 887021


2024年2月27日发(作者:tcp ip协议详解pdf)

安装mysql过程:

mysql解压版安装步骤

1.下载,解压到E盘(E:mysql-5.1.50-win32)。

2.复制为。

3.修改,在[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-win32data // 此处两目录需指向安装目录

[mysql]

default-character-set=utf8

4.安装mysql服务。(移除mysql服务mysqld --remove)

命令行下进入E:mysql-5.1.50-win32bin,运行mysqld --install mysql

--defaults-file="E:"。

E:mysql-5.1.50-win32bin>mysqld --install mysql

--defaults-file="E:"

Service successfully installed.

注:要加参数安装,不然mysql administrator启动时将提示:

Either the server service or the configuration file could not be

p 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-win32bin>net start mysql

mysql 服务正在启动 .

mysql 服务已经启动成功。

6.进入mysql,并给MYSQL的root用户加密码。

E:mysql-5.1.50-win32bin>mysql -uroot -p

Enter password:

此时密码为空,提示输入密码,直接回车。

E:mysql-5.1.50-win32bin>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;#退出

安装mysql时路径正确却安装不成功,提示以下

The service already exists!

The current server installed:以前安装mysql的地址/bin/mysqld-nt MYSQL

解决办法

移除原来的mysql服务

e:

cd E:JAVA FILESmysql-5.1.39-win32bin

mysqld --remove mysql --defaults-file="E:JAVA

"

pause

然后,重新安装一次:

e:

cd E:JAVA FILESmysql-5.1.39-win32bin

mysqld --install mysql --defaults-file="E:JAVA

"

pause

就可以看到安装成功了


本文标签: 安装 服务 密码 目录