• MySQL 5.7.13解压版安装记录 mysql无法启动教程


    1 解压缩

    2 添加环境变量,这个不细说了 

    我的电脑->属性->高级->环境变量

    选择PATH,在其后面添加: 你的mysql bin文件夹的路径 (如:C:Program FilesMySQLMySQL Server 5.6in )

    PATH=.......;C:Program FilesMySQLMySQL Server 5.6in (注意是追加,不是覆盖)

    3 修改mysql-default.ini

    # These are commonly set, remove the # and set as required.
    basedir = D:Program Filesmysql-5.7.13-winx64
    datadir = D:Program Filesmysql-5.7.13-winx64Data
    port = 3306

    cd C:Program FilesMySQLMySQL Server 5.6in 进入mysql的bin文件夹(不管有没有配置过环境变量,也要进入bin文件夹,否则之后启动服务仍然会报错误2)

    输入mysqld -install(如果不用管理员身份运行,将会因为权限不够而出现错误:Install/Remove of the Service Denied!) 

    安装成功

    5

    由于没有data目录,需要初始化.这是最关键的一点,千万不要net start mysql,前提是一定要执行过mysql的服务安装

    在bin目录执行 mysqld --initialize-insecure --user=mysql

    6 等待成功后

    直接可以启动mysql服务了

    7 mysql -u root -p

    登录mysql

    set password for root@localhost = password('yourpassword'); (不要漏了;)

    set password for root@%= password('yourpassword');

    8 添加远程登录权限

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION

    9

     flush privileges;

    刷新配置

    mysql 5.7忘记密码方法

    cmd切换到bin目录

    1 net stop mysql

    2 mysqld --console --skip-grant-tables

    3 打开新的cmd窗口切换到bin目录

    4 mysql -u root -p 登录密码为空

    5 use mysql;

    6 更新密码

    注意,不要使用

    UPDATE user SET Password=PASSWORD('newpassword') where USER='root';

    更新密码!!

    那是老版本的,会报 Unknown column 'password' in 'field list' 错误

    新版本已经把password字段改成了authentication_string.

    update mysql.user set authentication_string=password('你的密码') where user='root' ;

    重启服务即可.

    --- mysql 5.7  新增用户并授权方法

    MYSQL

    --cc 为用户名 ,password为密码
    mysql> create user 'cc'@'%' identified by 'password';
    Query OK, 0 rows affected (0.02 sec)

    mysql> grant all on *.* to 'cc'@'%'
    -> ;
    Query OK, 0 rows affected (0.00 sec)

     

  • 相关阅读:
    019-centos的yum用法
    018-DNS解析过程与配置DNS服务
    017-linux正则表达式
    016-sed
    014-配置SSH免密钥登录
    013-安装VNC服务
    012-centos6.5配置静态ip
    010-centos上安装matlab
    mysqlbinlog
    更换mysql数据库的datadir目录
  • 原文地址:https://www.cnblogs.com/MarsPanda/p/5713536.html
Copyright © 2020-2023  润新知