mysql 解压安装

原创
2016/03/14 22:37
阅读数 9
  1. 解压

  2. 配置环境变量

    path追加:D:\myprogram\mysql-5.7.11-winx64\bin;

  3. 配置my.ini文件

    basedir = D:\myprogram\mysql-5.7.11-winx64

    datadir = D:\myprogram\mysql-5.7.11-winx64\data

    创建data目录

  4. 加入Windows服务

    D:\myprogram\mysql-5.7.11-winx64\bin>mysqld -install

    Service successfully installed.

    D:\myprogram\mysql-5.7.11-winx64\bin>net start mysql

    MySQL 服务正在启动 ...

    MySQL 服务无法启动。

    服务没有报告任何错误。

    请键入 NET HELPMSG 3534 以获得更多的帮助。

    D:\myprogram\mysql-5.7.11-winx64\bin>mysqld --remove

    Service successfully removed.

    D:\myprogram\mysql-5.7.11-winx64\bin>mysqld --install

    Service successfully installed.

    D:\myprogram\mysql-5.7.11-winx64\bin>mysqld --initialize

    D:\myprogram\mysql-5.7.11-winx64\bin>net start mysql

    MySQL 服务正在启动 .

    MySQL 服务已经启动成功。

  5. 链接

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    net stop mysql

    [mysqld]这个条目下加入skip-grant-tables

    net start mysql

    mysql -u root -p

  6. 问题

    重改密码

    在5.7.9的mysql database的user表中没有password的字段了,更改为了authentication_string,所以修改root密码时使用

    mysql> update mysql.user set authentication_string=PASSWORD('root') where user='root';

        Query OK, 1 row affected, 1 warning (0.04 sec)

        Rows matched: 1  Changed: 1  Warnings: 1

        mysql> flush privileges;

        Query OK, 0 rows affected (0.00 sec)

        mysql> quit

        Bye

        C:\Windows\system32>mysql -u root -p

        Enter password: ****

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

        Your MySQL connection id is 3

        Server version: 5.7.11

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

 

Mac OS X - 重置 MySQL Root 密码
您是否忘记了Mac OS 的MySQL的root密码? 通过以下4步就可重新设置新密码:
1.  停止 mysql server.  通常是在 '系统偏好设置' > MySQL > 'Stop MySQL Server'
2.  打开终端,输入:
     sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
3.  打开另一个新终端,输入:
     sudo /usr/local/mysql/bin/mysql -u root
     UPDATE mysql.user SET authentication_string=PASSWORD('新密码') WHERE User='root';
     FLUSH PRIVILEGES;
     \q

4.  重启MySQL.

*以上方法针对 MySQL V5.7.9, 旧版的mysql请使用:UPDATE mysql.user SET Password=PASSWORD('新密码') WHERE User='root';

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

展开阅读全文
打赏
1
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
1
分享
返回顶部
顶部