【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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值