600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > Mac下Brew 卸载MySql以及安装Mysql 阿星小栈

Mac下Brew 卸载MySql以及安装Mysql 阿星小栈

时间:2019-02-08 15:57:08

相关推荐

Mac下Brew 卸载MySql以及安装Mysql 阿星小栈

卸载:

brew remove mysqlbrew cleanuplaunchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plistrm ~/Library/LaunchAgents/com.mysql.mysqld.plistsudo rm -rf /usr/local/var/mysql

brew uninstall mysql@5.7rm -rf /usr/local/var/mysqlrm /usr/local/etc/f--- 然后安装brew install mysql@5.7 // 安装brew link --force mysql@5.7 // 链接brew services start mysql@5.7 // 启动服务echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc // 输出到环境变量

安装:

搜索一下mysql版本:

brew search mysql

==> Formulaeautomysqlbackup mysql-cluster mysql-search-replace mysql@5.7mysql mysql-connector-cmysql-utilities mysqltunermysql++mysql-connector-c++ mysql@5.5mysql-clientmysql-sandbox mysql@5.6==> Caskshomebrew/cask/mysql-connector-python homebrew/cask/navicat-for-mysqlhomebrew/cask/mysql-shellhomebrew/cask/sqlpro-for-mysqlhomebrew/cask/mysql-utilities

安装mysql:

brew install mysql@5.7ln -sfv /usr/local/opt/mysql@5.7/*.plist ~/Library/LaunchAgents

启动mysql服务

$mysql.server start

继续执行mysql_secure_installation

cometdeMacBook-Pro:~ comet

$ mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: N // 这个选yes的话密码长度就必须要设置为8位以上,但我只想要6位的

Please set the password for root here.

New password:// 设置密码

Re-enter new password: // 再一次确认密码

By default, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account created for them. This is intended only for

testing, and to make the installation go a bit smoother.

You should remove them before moving into a production

environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y // 移除不用密码的那个账户

Success.

Normally, root should only be allowed to connect from

'localhost'. This ensures that someone cannot guess at

the 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' that

anyone can access. This is also intended only for testing,

and should be removed before moving into a production

environment.

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 changes

made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Success.

All done!

修改root密码

以前修改mysql密码字段是Password这个字段,但是mysql5.7没有这个字段而是使用了authentication_string替代

如果操作过程中报下面的错误

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

那么使用首先关闭mysql服务,然后以安全模式启动

mysql.server start --skip-grant-tables

use mysql

update user set authentication_string = password('root') where User='root';

Query OK, 1 row affected, 1 warning (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 1

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

最后可以参考:

/cheng649090216/article/details/79246333

/Bobdragery/article/details/90068643

/cheng649090216/article/details/79246333

/p/12e885cb6e33

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。