centos 安装mysql

来源:互联网 发布:淘宝怎样设置下架时间 编辑:程序博客网 时间:2024/05/23 18:34

1,下载mysql57-community-release-el7-8.noarch.rpm 的 YUM

wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

 

2,rpm -ivhmysql57-community-release-el7-8.noarch.rpm

 

3,reboot获得新密码   grep "password"/var/log/mysqld.log

 

4,登陆  mysql -uroot -p  

 

5,提示登陆密码,就把刚刚的

密码复制进去

 

6,修改密码 alter user'root'@'localhost' identified by 'Zabbix_Yang01';

       flush privileges;刷新才能生效

 

7,重新登陆即可


备注:

启动 MySQL服务:

service mysqld start

 

关闭 MySQL服务:

service mysqld stop

 

重启 MySQL服务:

service mysqld restart

 

查看 MySQL的状态:

service mysqld status


忘记密码时,可用如下方法重置:

# service mysqld stop

# mysqld_safe --user=root --skip-grant-tables --skip-networking&

# mysql -u root

mysql> use mysql;

mysql> update user setpassword=password("new_password") where user="root";

mysql> flush privileges;


原创粉丝点击