mac 用homebrew安装mysql,然后用navicat premium连接mysql

网友投稿 315 2022-08-26

mac 用homebrew安装mysql,然后用navicat premium连接mysql

感想

最近在做一个项目的demo,需要用到数据库,然后我这里把我的安装实战过程记录下来,方便后面进行知识梳理

基本安装

首先要安装homebrew,这里不是重点,这里默认大家都已经安装。

brew install mysqlmysql.server startmysql -uroot

然后上面的就是最基本的安装过程,然后我们可以就可以匿名登陆,不用输入密码了。

创建带密码的账户和密码

终端输入:

mysql_secure_installation

下面是我的创建过程:

Securing the MySQL server deployment.Connecting to MySQL using a blank password.VALIDATE PASSWORD COMPONENT can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD component?Press y|Y for Yes, any other key for No: yThere are three levels of password validation policy:LOW Length >= 8MEDIUM Length >= 8, numeric, mixed case, and special charactersSTRONG Length >= 8, numeric, mixed case, special characters and dictionary filePlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0Please set the password for root here.New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : yBy default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n ... skipping.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database...Success. - Removing privileges on test database...Success.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : ySuccess.All done! ➜ ~ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 11Server version: 8.0.12 HomebrewCopyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show database -> ;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || sys |+--------------------+4 rows in set (0.01 sec)

Navicat Premium 连接

打开该软件,然后创建一个连接,输入用户名和密码,连接的时候这里会报错:

2059 - Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(../Frameworks/caching_sha2_password.so, 2): image not found

这时候,打开终端:

#登陆mysqlmysql -u root -p#输入密码Enter password: xxx#修改加密规则ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;#更新一下用户的密码ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password'; #刷新权限 FLUSH PRIVILEGES;

连接的时候输入你的新密码(your_password),然后就可以连接了,本人亲自测试成功。

参考文献

[1].【Mac + Mysql + Navicat Premium】之Navicat Premium如何连接Mysql数据库.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:python3 使用多线程利用Instaloader从instagram上下载上数据
下一篇:你不知道的B2B营销新玩法之移动营销!(b2b平台营销方案)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~