美文网首页
MacBook之brew安装mysql

MacBook之brew安装mysql

作者: Yoteen | 来源:发表于2016-11-25 14:28 被阅读0次
    • 如果想重新安装mysql必须先卸载老mysql安装文件。
    brew remove mysql  
    brew cleanup  
    launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist  
    rm ~/Library/LaunchAgents/com.mysql.mysqld.plist  
    sudo rm -rf /usr/local/var/mysql  
    
    • 下面开始重新安装mysql,第二句意思是设置mysql为开机启动项目。
    brew install mysql  
    ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents  
    mysql.server start  
    
    • mysql安装完毕。下面配置密码信息;
      mysql -uroot
    select user,password,host from mysql.user;  
    delete from mysql.user where user='';  
    delete from mysql.user where host='::1';  
    set password for root@localhost=password('123456');  
    GRANT ALL PRIVILEGES ON *.* TO 'miaohr'@'%'  IDENTIFIED BY '123456';  
    flush privileges;  
    
    • 如果想修改mysql的配置,在/usr/local/etc下建立一个my.cnf,例如增加log
    [mysqld]  
    general-log  
    general_log_file = /usr/local/var/log/mysqld.log  
    
    • mysql.server restart

    相关文章

      网友评论

          本文标题:MacBook之brew安装mysql

          本文链接:https://www.haomeiwen.com/subject/aozipttx.html