MYSQL几个常用命令使用

时间:2022-11-18 19:12:18

一. mysql 修改密码

1. mysql -u root -p root 输入原密码登录命令行

2. use mysql;

3. update user set password=password('root123') where 'user' = 'root'; 5.7版本 update user set authentication_string=password('root123') where 'user' = 'root';

4. flush privileges; 提交应用.

5. You must reset your password using ALTER USER statement before executing this statement必须修改临时密码,命令:alter user user() identified by '@Juaner521';

二. mysql 修改远程连接

1. mysql -u root -p root

2. use mysql;

3. select host,user,password from user;查看是否允许远程连接

4. grant all privileges on *.* to root@'%' identified by "password"; , 如果 报错,可换个方法

#创建一个新的账户
CREATE USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'xxxxxx';
#给这个账户所有权限
GRANT ALL PRIVILEGES ON *.* TO'username'@'%';

1. flush privileges;

三. win 添加mysql服务:

1. 进入mysql\bin文件夹:mtsqld --install;

2. 如果提示:install/remove of the service denide,以管理员身份运行cmd。

四. 报错Ignoring the redo log due to missing... :

删除 mysql/data/目录下ib_logfile0``ib_logfile1重启就好。

推荐PHP项目(完整):​ ​​点此直接网盘下载​