zoukankan      html  css  js  c++  java
  • window环境mysql解压版配置

    1、下载并解压

    到官网下载mysql-5.5.10-win32.zip,然后将mysql解压到任意路径,如:C:mysql-5.5.10-win32 

    2、设置环境变量

    打开计算机->属性->高级系统设置->环境变量,新建一个环境变量,变量名为:MYSQL_HOME,变量值为你的mysql根目录,如:C:mysql-5.5.10-win32 
    然后在系统变量Path中添加:;%MYSQL_HOME%in

    3、安装mysql服务

    以管理员身份打开命令提示符,执行命令:mysqld -installmysql服务安装到windows的服务

    注:如果要卸载mysql服务,执行:mysqld -remove

    4、启动mysql服务

    执行:net start mysql

    注:如果要停止mysql服务,执行:net stop mysql

    5、设置密码

    输入mysql -uroot进入mysql(默认root密码为空)

    执行

    mysql> use mysql ;
    mysql> update user set password=password("new_pass") where user="root"; 
    mysql> flush privileges; 
    mysql> exit ;

    6、登录

    输入mysql -uroot -p回车

    输入密码

    如果忘记密码

    步骤如下:
    1.停止mysql服务

    以管理员身份,在cmd命令行下运行: net stop mysql
    2.使用 mysqld –skip-grant-tables 命令启动mysql数据库
    C:Windowssystem32>net stop mysql
    C:Windowssystem32>mysqld --skip-grant-tables

    3.不关闭以上窗口,新开一个cmd窗口,输入mysql -u root,直接按回车键
    C:Windowssystem32>mysql -u root
    Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 1 Server version: 5.1.26-rc-community MySQL Community Server (GPL) Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
    mysql> update mysql.user set password=password('sxm') where user='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)

    4.停止mysql,mysqld进程

    打开任务管理器,停止mysql和mysqld进程

    5开启服务,正常登录

    使用net start mysql启动mysqld服务,就可以使用root用户 root密码进入数据库了

    mysql -u root -p sxm


    补充说明:
    1.mysqld使用说明可以使用如下命令获取查看:
    mysqld --verbose --help > d:mysqld_help.txt
    帮助中–skip-grant-tables的帮助为:
    --skip-grant-tables Start without grant tables. This gives all users FULL ACCESS to all tables!
    所以我们可以使用mysql -uroot而不用密码直接登陆mysql,而且可以修改任何表。

  • 相关阅读:
    CentOS 7安装配置FTP服务器
    Python验证码
    Eclipse快捷键
    mybatis中的#和$的区别
    spring framework 各版本源码下载地址
    maven的pom.xml文件标签含义
    maven学习笔记
    (转)C#调用非托管Win 32 DLL
    (转)读取XML数据到treeView中
    SpringSecurity学习二----------实现自定义登录界面
  • 原文地址:https://www.cnblogs.com/shixm/p/5473366.html
Copyright © 2011-2022 走看看