典型问题
删除当前服务器登陆的其他终端连接#
w
pkill -kill -t pts/0
限制单条sql对于资源的消耗#
mysql
SET GLOBAL MAX_EXECUTION_TIME=1000;
修改mysql登陆密码#
sudo systemctl stop mysql
vim /etc/my.cnf # 在/etc/my.cnf/mysqld下添加 skip-grant-tables
=========================
[mysqld]
skip-grant-tables
=========================
sudo systemctl start mysql
mysql -uroot
=========================
use mysql;
select * from user;
#如果有root账户的话,可以用以下操作
set password for root@localhost = password('3qdzlybjlsltdhl45s');
flush privileges;
quit;
=========================
vim /etc/my.cnf # 在/etc/my.cnf/mysqld下注释 skip-grant-tables
=========================
[mysqld]
#skip-grant-tables
=========================
sudo systemctl restart mysql
不使用mysql的权限系统,启动mysql
删除user表
重新授权root用户拥有全部权限
mysqld_safe --skip-grant-tables &
mysql -u root
===in mysql client,exucte the below code============
use mysql; #使用mysql表
select user,host from user; #查询现有的用户和host
truncate table user; #truncate,将删除所有用户
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root-password';
grant all privileges on *.* to root@localhost identified by '' with grant option;
#给root用户在localhost上的全部权限,密码设为 3qdzlybjlsltdhl45s
grant all privileges on *.* to 'root'@'%' identified by '111111' with grant option;
#给root用户在localhost上的全部权限,密码设为空
grant all privileges on *.* to root@localhost identified by '' with grant option;
grant all privileges on *.* to root@% identified by '111111' with grant option;
#给root用户在全部ip上的全部权限,密码设为 3qdzlybjlsltdhl45s
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '3qdzlybjlsltdhl45s' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '111111' WITH GRANT OPTION;
flush privileges; # keep flush privileges in the last
====================================================
grant#
-- Grant user permissions to all tables in my_database from localhost --
GRANT ALL ON my_database.* TO 'user'@'localhost';
-- Grant user permissions to my_table in my_database from localhost --
GRANT ALL ON my_database.my_table TO 'user'@'localhost';
-- Grant user permissions to all tables and databases from all hosts --
GRANT ALL ON *.* TO 'user'@'*';
参考#
https://cloud.tencent.com/developer/article/1914308
https://dev.mysql.com/blog-archive/server-side-select-statement-timeouts/
https://blog.csdn.net/weixin_52730346/article/details/120749827
https://stackoverflow.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0
https://blog.csdn.net/u010814698/article/details/77878866?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-2-77878866-blog-109804438.pc_relevant_3mothn_strategy_and_data_recovery&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-2-77878866-blog-109804438.pc_relevant_3mothn_strategy_and_data_recovery
update user set password=password("111111") where user="root";