V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
chuanqirenwu
V2EX  ›  MySQL

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

  •  
  •   chuanqirenwu · 2018-09-27 20:17:17 +08:00 · 3911 次点击
    这是一个创建于 2008 天前的主题,其中的信息可能已经有所发展或是发生改变。

    通过 homebrew 新装了 mariadb

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

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

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

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

    第 1 条附言  ·  2018-09-27 23:15:26 +08:00
    好吧!我解决了,解决方式特别简单,重新启动 Mac OS !!!
    12 条回复    2018-09-28 08:56:20 +08:00
    liprais
        1
    liprais  
       2018-09-27 20:22:43 +08:00
    brew install 装完了以后有一大段说明你肯定没看
    chuanqirenwu
        2
    chuanqirenwu  
    OP
       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
        3
    evlos  
       2018-09-27 20:35:05 +08:00
    mysql_install_db 看看
    forrestshuang
        4
    forrestshuang  
       2018-09-27 20:39:19 +08:00
    docker 装,这年头本地下软件,很难受的
    chuanqirenwu
        5
    chuanqirenwu  
    OP
       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
        6
    chuanqirenwu  
    OP
       2018-09-27 22:37:06 +08:00
    @forrestshuang 这个不是解决问题的方式吧,那终极解决方案就是换到 windows 了。
    alvinbone88
        7
    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
        8
    alvinbone88  
       2018-09-27 23:32:22 +08:00
    看错了,先把错误号贴上来
    EvilCult
        9
    EvilCult  
       2018-09-27 23:49:40 +08:00 via iPhone
    我一直认为终极的解决办法是………… Vagrant …………
    Trim21
        10
    Trim21  
       2018-09-28 00:33:01 +08:00 via Android
    docker 装+1
    GTim
        11
    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
        12
    chuanqirenwu  
    OP
       2018-09-28 08:56:20 +08:00
    @GTim 应该不是这个问题,重启 mac 解决了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3951 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 10:23 · PVG 18:23 · LAX 03:23 · JFK 06:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.