mysql安装(windows、linux)

windows:

https://blog.csdn.net/florachy/article/details/72769791

修改mysql root用户密码

1) 停止mysql服务 运行输入services.msc 停止mysql服务

或者 cmd -->  net stop mysql

2) 在cmd下 输入 mysqld --skip-grant-tables 启动服务器 光标不动 (不要关闭该窗口)

3) 新打开cmd 输入mysql -u root -p 不输入密码直接回车

use mysql;

update user set password=password('root') WHERE User='root';

如果password不能识别,使用 authentication_string

update user set authentication_string=password('root') WHERE User='root';

4) 关闭两个cmd窗口 在任务管理器结束mysqld 进程

5) 在服务管理页面 重启mysql 服务

密码修改完成

然后安装sqlyog小海豚

小海豚如果提示密码过期

https://blog.csdn.net/Cryhelyxx/article/details/42426069

centOs:

https://blog.csdn.net/z13615480737/article/details/78906598?utm_source=copy

下载mysql的repo源 这个安装的mysql5.7.20  /**纠正一下,这源下载的是最新的版本  ****/

  创建/export/software/文件夹放下载的东西

  [root@localhost ~]# cd /export/software/

   [root@localhost software]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm 

   [root@localhost software]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm 

   [root@localhost software]#  yum -y install mysql-server 

(也可以指定安装目录     yum --installroot=/usr/local/mysql --releasever=/ -y install mysql-server  )我没试,这样装环境变量配置都不用你管,装上直接启动就行。安装路径是默认的。

配置  my.cnf        vim /etc/my.cnf 也可图形化界面直接改

文末加上:

server_id = 1

expire_logs-days = 3

validate_password = off

default_password_lifetime = 0

启动mysql服务

mysql -u root

service mysqld restart

 如果忘记密码就先重置密码,登陆进去再改密码

重置密码: grep "password" /var/log/mysqld.log

mysql -u root -p 输入生成的密码

SET PASSWORD = PASSWORD('新的密码')

Grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;

flush privileges;

重新登陆

猜你喜欢

转载自blog.csdn.net/weixin_42490528/article/details/82980489
今日推荐