【Mysql】常用操作

Ubuntu 安装

  • 安装mysql-server:sudo apt-get install mysql-server
  • 安装mysql-client :sudo apt install mysql-client
  • 安装dev :sudo apt install libmysqlclient-dev

参考:https://blog.csdn.net/yinjianxiang/article/details/76861719

 

Ubuntu 卸载

  • 查看依赖:dpkg --list | grep mysql
  • 卸载: sudo apt-get remove mysql-common
  • 卸载: sudo apt-get autoremove --purge mysql-server-5.7
  • 清除残留数据: dpkg -l | grep ^rc | awk '{print$2}' | sudo xargs dpkg -P
  • 继续删除剩余依赖项:sudo apt-get autoremove --purge mysql-apt-config

参考:https://blog.csdn.net/iehadoop/article/details/82961264

 

Ubuntu下 基本操作

  • 启动:sudo /etc/init.d/mysql start
  • 停止:sudo /etc/init.d/mysql stop
  • 重启:sudo /etc/init.d/mysql restart
  • 查看日志:cat /var/log/mysql.err cat /var/log/mysql/error.log

参考:https://www.imooc.com/article/45052

 

创建授权

  • 创建用户:create user 'root'@'localhost' identified by '123';
  • 授权用户:grant all privileges on *.* to root@localhost identified by '123';
  • 授权指定IP:GRANT ALL PRIVILEGES ON *.* TO 'root'@'123.123.123.123' IDENTIFIED BY 'root' WITH GRANT OPTION;

参考:https://www.cnblogs.com/xujishou/p/6306765.html

 

解决 Access denied

  • 修改验证方式:update user set authentication_string=password("123"),plugin='mysql_native_password' where user='root';

参考:https://www.cnblogs.com/cpl9412290130/p/9583868.html

你可能感兴趣的:(………数据库)