澳门新浦京娱乐场网站-www.146.net-新浦京娱乐场官网
做最好的网站

安装免安装版的mysq服务的方法l,MySQL安装与卸载

1.什么是数据库?

1.将安装包解压到没有中文的目录文件夹下,例如:D:workspacemysql-5.6.25-win32。

1、首次安装 root初始密码为空,注意就是没有密码,直接敲回车即可进入

安装免安装版的mysq服务的方法l,MySQL安装与卸载。  俗称数据的仓库,方便管理数据的软件(或程序)

2.打开cmd窗口,进入到安装目录下,

注:在centos7下安装mysql5.6初次密码并不为空,而是生成了一个随机的密码。

2.MySQL入门

  1.官网下载

  2.安装MySql

  直接双击安装即可,但注意安装的目录不可出现中文。

  2.1验证安装是否成功

  打开命令行-->输入 "mysql -u root -p" 回车,输入密码-->回车

  出现以下内容,即为成功。

  C:UsersAdministrator>mysql -u root -p
  Enter password: ******
  Welcome to the MySQL monitor. Commands end with ; or g.
  Your MySQL connection id is 2
  Server version: 5.5.30 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>

  3.卸载MySQL(以Win7系统为例)

    a.停止window的MySQL服务

    找到“控制面板”-->"管理工具“-->"服务",停止MySQL后台服务

    b.卸载MySQL安装程序

    ”控制面板“-->"程序和功能",卸载MySQL程序

    c.删除MySQL安装目录下的所有文件

    d.删除C盘ProgramData隐藏目录中关于MySQL的目录

      ProgramData这是C盘下的一个隐藏目录,打开”显示隐藏文件“功能,即可查到

      删除即可。

    

 

C:Windowssystem32>d:
D:>cd D:workspacemysql-5.6.25-win32bin

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

 

D:wampbinmysqlmysql5.6.17bin>mysql -uroot -p

3.输入“mysqld -install”,此语句为安装mysql。(移除为“mysqld -remove”)

Enter password: [直接回车]

D:workspacemysql-5.6.25-win32bin>mysqld -install

Welcome to the MySQL monitor. Commands end with ; or g.

 

Your MySQL connection id is 7

4.安装成功后,输入“net start mysql”,启动服务,("net stop mysql"停止服务 )

Server version: 5.6.17 MySQL Community Server (GPL)

D:workspacemysql-5.6.25-win32bin>net start mysql

Copyright (c) 2000, 2014,Oracleand/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

5.成功后登录时输入“mysql -u root -p”首次安装root的密码为空,回车即可

affiliates. Other names may be trademarks of their respective

D:workspacemysql-5.6.25-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.6.25 MySQL Community Server (GPL)

owners.

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

mysql>

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

2、修改root密码的几种方法:

5.退出输入“exit”或“quit”即可。

1) 用SET PASSWORD命令

首先登录MySQL。

格式:mysql> set password for 用户名@localhost = password('新密码');

例如:

mysql>set password for root@localhost = password('root');

Query OK, 0 rows affected (0.00 sec)

mysql>quit

Bye

D:wampbinmysqlmysql5.6.17bin>mysql -uroot -proot

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or g.

澳门新浦京娱乐场网站,Your MySQL connection id is 8

Server version: 5.6.17 MySQL Community Server (GPL)

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

2)用mysqladmin

格式:mysqladmin -u用户名 -p旧密码 password 新密码

例如:

D:wampbinmysqlmysql5.6.17bin>mysqladmin -uroot -proot password root123

Warning: Using a password on the command line interface can be insecure.

D:wampbinmysqlmysql5.6.17bin>mysql -uroot -proot123

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 10

Server version: 5.6.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, 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)用UPDATE直接编辑user表

首先登录MySQL。

mysql> use mysql;

mysql> update user set password=password('root') where user='root' and host='localhost';

mysql> flush privileges;

--注意一定要flush privileges;

mysql 新设置用户或更改密码后需用flush privileges刷新MySQL的系统权限相关表,否则会出现拒绝访问,还有一种方法,就是重新启动mysql服务器,来使新设置生效。

4)在忘记root密码的时候,可以这样。

以windows为例:

  1. 关闭正在运行的MySQL服务。

  2. 打开DOS窗口,转到mysqlbin目录。

  3. 输入mysqld --skip-grant-tables 回车。--skip-grant-tables 的意思是启动MySQL服务的时候跳过权限表认证。

4. 再开一个DOS窗口(因为刚才那个DOS窗口已经不能动了),转到mysqlbin目录。

  1. 输入mysql回车,如果成功,将出现MySQL提示符 >。

  2. 连接权限数据库: use mysql; 。

  3. 改密码:update user set password=password('root123') where user='root';(别忘了最后加分号) 。

  4. 刷新权限(必须步骤):flush privileges;

  5. 退出quit当前cmd,并且关闭2中的DOS窗口

  6. 使用用户名root,新密码root123在4中DOS窗口登录。

本文由澳门新浦京娱乐场网站发布于数据库,转载请注明出处:安装免安装版的mysq服务的方法l,MySQL安装与卸载