当前位置:   article > 正文

ubuntu23下面進行mysql8初始化_ubuntu mtysql8初始化数据库

ubuntu mtysql8初始化数据库

依賴包:

  1. (Python3.6) appleyuchi@ubuntu:~$ dpkg --list|grep mysql
  2. ii mysql-client 8.0.33-0ubuntu0.23.04.2 all MySQL database client (metapackage depending on the latest version)
  3. ii mysql-client-8.0 8.0.33-0ubuntu0.23.04.2 amd64 MySQL database client binaries
  4. ii mysql-client-core-8.0 8.0.33-0ubuntu0.23.04.2 amd64 MySQL database core client binaries
  5. ii mysql-common 5.8+1.1.0 all MySQL database common files, e.g. /etc/mysql/my.cnf
  6. ii mysql-server 8.0.33-0ubuntu0.23.04.2 all MySQL database server (metapackage depending on the latest version)
  7. ii mysql-server-8.0 8.0.33-0ubuntu0.23.04.2 amd64 MySQL database server binaries and system database setup
  8. ii mysql-server-core-8.0 8.0.33-0ubuntu0.23.04.2 amd64 MySQL database server binaries

如何登陸?

  1. 方法一:
  2. 得到隨機密碼(貌似只能用一次):
  3. cat /etc/mysql/debian.cnf
  4. password = kXNyPNJ4DMiErsQh
  5. mysql -uroot -p
  6. kXNyPNJ4DMiErsQh
  1. 方法二
  2. /etc/mysql/mysql.conf.d/mysqld.cnf
  3. 加入skip-grant-tables
  4. service mysql restart
  5. flush privileges;
  6. CREATE USER 'appleyuchi'@'%' IDENTIFIED with mysql_native_password BY 'appleyuchi';
  7. 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:

【1】ubuntu安装mysql及初始化【ububtu22, mysql8】 - 码农教程

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/65170
推荐阅读
相关标签
  

闽ICP备14008679号