• mysql8.0.21在ubuntu20.04下的配置问题


    一、安装命令

    sudo apt install mysql-server
    # 查看mysql安装状态
    sudo service mysql status
    

    二、配置文件的问题

    1、配置文件的位置: /etc/mysql


    debian.cnf: 保存着账号信息
    my.cnf: 指出实际配置文件的位置:/etc/mysql/mysql.conf.d/

    mysqld.cnf: 实际的配置信息

    2、其他文件位置

    /usr/bin                 客户端程序和脚本  
    /usr/sbin                mysqld 服务器  
    /var/lib/mysql           日志文件,数据库  [重点要知道这个]  
    /usr/share/doc/packages  文档  
    /usr/include/mysql       包含( 头) 文件  
    /usr/lib/mysql           库  
    /usr/share/mysql         错误消息和字符集文件  
    /usr/share/sql-bench     基准程序  
    

    三、初始密码的问题

    1、root用户的状态

    2、更改root用户的密码

    在更改密码的同时,还修改user表中的plugin字段为‘mysql_native_password’,该字段的作用还不太明了,看官网说明,大概是密码的验证方式之类的。但不改这个直接修改密码好像还不成功。

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
    

    3、新添加用户并授权

    create user 'admin'@'%' identified by '123';
    grant all on * to 'admin'@'%' with grant option;
    alter user 'admin'@'%' identified with mysql_native_password by '456';
    

    四、msyqlclient的安装问题

    • mysqlclient安装不成功主要缺少两个包:
    sudo  apt-get install libmysqlclient-dev libpython3.8-dev
    
    • 如果还有错,那就把wheel装上:
    pip install wheel
    

    五、卸载的问题

    Removing MySQL with APT

    • To uninstall the MySQL server and the related components that have been installed using the MySQL APT repository, first, remove the MySQL server using the following command:

    shell> sudo apt-get remove mysql-server

    • Then, remove any other software that was installed automatically with the MySQL server:

    shell> sudo apt-get autoremove

    • To uninstall other components, use the following command, replacing package-name with the name of the package of the component you want to remove:

    shell> sudo apt-get remove package-name

    • To see a list of packages you have installed from the MySQL APT repository, use the following command:

    shell> dpkg -l | grep mysql | grep ii

    六、遇到的坑

    mysql> show tables;
    ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist
    mysql> show databases;
    ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist
    
    • 第一步,停止MySql服务
    service mysql stop
    
    • 第二步,用mysqld对MySql的一些文件进行升级
    sudo mysqld --upgrade=FORCE
    
  • 相关阅读:
    ORM补充文件
    auth.User.groups: (fields.E304) Reverse accessor for 'User.groups'
    JS BOM和DOM
    ctrl+shift+上箭头 改变代码位置
    盒子半透明
    多背景颜色写图片后面
    心跳
    动画
    仿站小工具哈哈哈
    旋转案例
  • 原文地址:https://www.cnblogs.com/xiaolee-tech/p/13434057.html
Copyright © 2020-2023  润新知