Mac 新装 mariadb 后 root 用户登录无任何权限

2018-09-27 20:17:17 +08:00
 chuanqirenwu

通过 homebrew 新装了 mariadb

然后通过 mysql -u root 登录用户后,发现无论执行什么命令都没有任何权限。

因为没有任何权限,所以执行的任何命令都是 access denied,网上搜了很多解决方案,对我都不适用,例如运行 mysql_secure_installation,或者 grant all on ...,或者登录修改 root 用户密码等等,因为没有任何操作权限,所以你对数据库的任何操作都不起作用。即使想 select * from mysql.user 想看看用户表的情况也是 access denied。

那么,我装这个数据库到底有什么用呢?

大神们用没有什么解决方案或者思路? windows 就没有这种问题,谁跟我说开发 Mac 好用的!!骗人骗人!

3939 次点击
所在节点    MySQL
12 条回复
liprais
2018-09-27 20:22:43 +08:00
brew install 装完了以后有一大段说明你肯定没看
chuanqirenwu
2018-09-27 20:31:33 +08:00
@liprais 看了的,还复制出来记录了

MySQL is configured to only allow connections from localhost by default

To connect:
mysql -uroot

To have launchd start mariadb now and restart at login:
brew services start mariadb
Or, if you don't want/need a background service you can just run:
mysql.server start
==> Summary
🍺 /usr/local/Cellar/mariadb/10.3.9: 651 files, 174.3MB
evlos
2018-09-27 20:35:05 +08:00
mysql_install_db 看看
forrestshuang
2018-09-27 20:39:19 +08:00
docker 装,这年头本地下软件,很难受的
chuanqirenwu
2018-09-27 22:36:20 +08:00
@evlos WARNING: The host 'YangdeMacBook-Pro.local' could not be looked up with /usr/local/Cellar/mariadb/10.3.9/bin/resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MariaDB version. The MariaDB daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MariaDB privileges !
Installing MariaDB/MySQL system tables in '/usr/local/var/mysql' ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/local/Cellar/mariadb/10.3.9/bin/mysqladmin' -u root password 'new-password'
'/usr/local/Cellar/mariadb/10.3.9/bin/mysqladmin' -u root -h YangdeMacBook-Pro.local password 'new-password'

Alternatively you can run:
'/usr/local/Cellar/mariadb/10.3.9/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr/local/Cellar/mariadb/10.3.9' ; /usr/local/Cellar/mariadb/10.3.9/bin/mysqld_safe --datadir='/usr/local/var/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/Cellar/mariadb/10.3.9/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

按照它的建议做了一些事,但好像依然没有效果
chuanqirenwu
2018-09-27 22:37:06 +08:00
@forrestshuang 这个不是解决问题的方式吧,那终极解决方案就是换到 windows 了。
alvinbone88
2018-09-27 23:15:05 +08:00
https://mariadb.com/kb/en/library/connecting-to-mariadb/
The user name is either your Unix login name, or ODBC on Windows.
alvinbone88
2018-09-27 23:32:22 +08:00
看错了,先把错误号贴上来
EvilCult
2018-09-27 23:49:40 +08:00
我一直认为终极的解决办法是………… Vagrant …………
Trim21
2018-09-28 00:33:01 +08:00
docker 装+1
GTim
2018-09-28 08:39:53 +08:00
根据第一段的描述,是因为 /usr/local/Cellar/mariadb/10.3.9/bin/resolveip 没法解析 localhost 这个域名

解决办法之一就是运行 /usr/local/Cellar/mariadb/10.3.9/bin/resolveip localhost 先正确解析下
chuanqirenwu
2018-09-28 08:56:20 +08:00
@GTim 应该不是这个问题,重启 mac 解决了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/493300

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX