2020.12-macOS安装+使用navicat连接本地MySQL数据库(127.0.0.1:3306)

2020.12-macOS连接本地数据库(127.0.0.1:3306)

Reference

https://www.macwk.com/

mariadb安装:https://www.cnblogs.com/leechenxiang/p/10506995.html

在本地安装mariadb数据库(macOS使用brew系列命令,如果是linux可能需要使用yum系列命令)

安装命令可以使用brew系列的安装命令

本地启动mariadb数据库

$ mysql.server start
Starting MariaDB
.201214 13:05:10 mysqld_safe Logging to '/usr/local/var/mysql/XXXdeMacBook-Pro.local.err'.
201214 13:05:10 mysqld_safe Starting mariadbd daemon with databases from /usr/local/var/mysql
 SUCCESS! 

出现SUCCESS!时代表数据库成功启动

重启电脑(服务器)后注意可能需要重启mysql服务,否则可能会报错 2003 - Can't connect to MySQL server on '127.0.0.1' (61 "Connection refused")

开启远程客户端连接

如果希望使用本地的navicat工具对数据库进行远程连接管理,则需要开启远程客户端的连接。

在zsh中输入mysql,进入数据库界面

$ mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 10.5.6-MariaDB Homebrew

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 
MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by '密码密码密码';
Query OK, 0 rows affected (0.016 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)
注:在以上代码段中,root@后边的百分号%需要用允许连接的ip地址进行替代,例如127.0.0.1,或者使用localhost等
进行以上操作后,可以使用navicat对数据库进行连接

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值