5.7mysql安装问题
1.mysql安装了,查看是运行状态,无法停止,无法重启
安装命令:
查看mysql的进程:
ps -e|grep mysql
杀死mysql的进程:
sudo killall mysqld
查看mysql的状态:
service mysqld status
查看某个目录的占用内存情况:
du -ah --max-depth=1
操作mysql:
systemctl start mysqld.service 启动
systemctl stop mysqld.service 停止
systemctl restart mysqld.service 重启
etc/my.cnf mysql配置文件
mysql忘记密码的操作:
一、首先更改my.cnf的配置文件,并重启mysql
在my.cnf文件中的[mysqld] 下加入下面一行,其余不做改变。
[root@localhost ~]# vim /etc/my.cnf
[mysqld]
skip-grant-tables
[root@localhost ~]# systemctl restart mysqld
二、登录MySQL,此时不需要输入密码,直接回车即可
mysql -uroot -p
三、切换到mysql数据库,查询user表的结构,这里有需要的字段。
在MySQL5.7版本中mysql数据库下已经没有password这个字段了,password字段改成了authentication_string字段。
四、修改mysql的root密码并退出mysql
mysql> update user set authentication_string=password('djb123.') where user='root';
Query OK, 0 rows affected, 1 warning (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 1
mysql> \q
Bye
五、再次修改my.cnf配置文件,将第一步添加的语句注释或删除,然后重启mysql。
[root@localhost ~]# vim /etc/my.cnf
[mysqld]
#skip-grant-tables
[root@localhost ~]# systemctl restart mysqld
六、用新密码登录mysql
修改mysql可以远程连接:
来源:CSDN
作者:爱技术的小雏鹰
链接:https://blog.csdn.net/weixin_43761325/article/details/104401254