赞
踩
依賴包:
- (Python3.6) appleyuchi@ubuntu:~$ dpkg --list|grep mysql
- ii mysql-client 8.0.33-0ubuntu0.23.04.2 all MySQL database client (metapackage depending on the latest version)
- ii mysql-client-8.0 8.0.33-0ubuntu0.23.04.2 amd64 MySQL database client binaries
- ii mysql-client-core-8.0 8.0.33-0ubuntu0.23.04.2 amd64 MySQL database core client binaries
- ii mysql-common 5.8+1.1.0 all MySQL database common files, e.g. /etc/mysql/my.cnf
- ii mysql-server 8.0.33-0ubuntu0.23.04.2 all MySQL database server (metapackage depending on the latest version)
- ii mysql-server-8.0 8.0.33-0ubuntu0.23.04.2 amd64 MySQL database server binaries and system database setup
- ii mysql-server-core-8.0 8.0.33-0ubuntu0.23.04.2 amd64 MySQL database server binaries
如何登陸?
- 方法一:
- 得到隨機密碼(貌似只能用一次):
- cat /etc/mysql/debian.cnf
- password = kXNyPNJ4DMiErsQh
- mysql -uroot -p
- kXNyPNJ4DMiErsQh
- 方法二
- /etc/mysql/mysql.conf.d/mysqld.cnf
- 加入skip-grant-tables
- service mysql restart
-
- flush privileges;
- CREATE USER 'appleyuchi'@'%' IDENTIFIED with mysql_native_password BY 'appleyuchi';
- CREATE USER 'root'@'%' IDENTIFIED with mysql_native_password BY 'appleyuchi';
-
-
-
--------------------------------------------------------------------------------------
授权:
GRANT ALL PRIVILEGES ON database_name.* TO 'appleyuchi'@'%' WITH GRANT OPTION;
--------------------------------------------------------------------------------------
/etc/mysql/mysql.conf.d/mysqld.cnf
#skip-grant-tables
service mysql restart
--------------------------------------------------------------------------------------------------------------------------------
查看权限:
mysql> SHOW GRANTS FOR 'appleyuchi'@'%';
--------------------------------------------------------------------------------------------------------------------------------
看看有哪些用戶名:
use mysql;
select User from user;
刪除用戶:
mysql> DROP USER 'appleyuchi'
Reference:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。