V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
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 · Sep 27, 2018 · 4563 views
    This topic created in 2772 days ago, the information mentioned may be changed or developed.

    通过 homebrew 新装了 mariadb

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

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

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

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

    Supplement 1  ·  Sep 27, 2018
    好吧!我解决了,解决方式特别简单,重新启动 Mac OS !!!
    12 replies    2018-09-28 08:56:20 +08:00
    F281M6Dh8DXpD1g2
        1
    F281M6Dh8DXpD1g2  
       Sep 27, 2018
    brew install 装完了以后有一大段说明你肯定没看
    chuanqirenwu
        2
    chuanqirenwu  
    OP
       Sep 27, 2018
    @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  
       Sep 27, 2018
    mysql_install_db 看看
    forrestshuang
        4
    forrestshuang  
       Sep 27, 2018
    docker 装,这年头本地下软件,很难受的
    chuanqirenwu
        5
    chuanqirenwu  
    OP
       Sep 27, 2018
    @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
       Sep 27, 2018
    @forrestshuang 这个不是解决问题的方式吧,那终极解决方案就是换到 windows 了。
    alvinbone88
        7
    alvinbone88  
       Sep 27, 2018
    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  
       Sep 27, 2018
    看错了,先把错误号贴上来
    EvilCult
        9
    EvilCult  
       Sep 27, 2018 via iPhone
    我一直认为终极的解决办法是………… Vagrant …………
    Trim21
        10
    Trim21  
       Sep 28, 2018 via Android
    docker 装+1
    yemoluo
        11
    yemoluo  
       Sep 28, 2018
    根据第一段的描述,是因为 /usr/local/Cellar/mariadb/10.3.9/bin/resolveip 没法解析 localhost 这个域名

    解决办法之一就是运行 /usr/local/Cellar/mariadb/10.3.9/bin/resolveip localhost 先正确解析下
    chuanqirenwu
        12
    chuanqirenwu  
    OP
       Sep 28, 2018
    @GTim 应该不是这个问题,重启 mac 解决了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2067 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 16:12 · PVG 00:12 · LAX 09:12 · JFK 12:12
    ♥ Do have faith in what you're doing.