Mac Pro Decompression install MySQL binary distribution version mysql-5.6.30-osx10.11-x86_64.tar.gz (not DMG)

Source: Internet
Author: User

Without the Mac root password, the current user has sudo permission, so the command to execute as root is added sudo.
Is there a _mysql user and user group, and see if the user _mysql is a member of the user group _mysql.
Move the extracted code to the/usr/local/mysql directory.

#切换到/usr/local/mysql Directory

Cd/usr/local/mysql

#是否存在_mysql用户和用户组 and see if the user _mysql is not a member of the _mysql group

$ DSCL. -list/users|grep _mysql

$ DSCL. -list/groups|grep _mysql

$ dsmemberutil checkmembership-u _mysql-g _mysql

# from the official document, install MySQL only need to rely on users to run, do not need to log in. So when you think of installing, there is a user who is not logged in

$ sudo chown-r _mysql.
$ sudo chgrp-r _mysql.
$ sudo./scripts/mysql_install_db--user=_mysql--datadir=/usr/local/mysql/data
$ sudo chown-r root.
$ sudo chown-r _mysql./data

# Modify configuration file

#开启日志并调整下
Log_bin = Mysql-bin
Max-binlog-size = 10M
Expire_logs_days = 3

#根据输出日志作的添加选项
Explicit_defaults_for_timestamp
Lower_case_table_names = 2

#根据实际进行修改, the last User=_mysql parameter can only be started by the root user, and non-root users can use sudo
Basedir =/usr/local/mysql
DataDir =/usr/local/mysql/data
Port = 3306
server_id = 1
user = _mysql


#使用脚本管理 (start|stop|restart|reload|force-reload|status) MySQL

$ sudo cp support-files/mysql.server MySQL

$ sudo vim MySQL

#把东东都放到这目录, easy to delete later (runtime does not find the build lock file)

Basedir=/usr/local/mysql
Datadir= "$basedir/data"
Lock_file_path= "$basedir/mysql_lock"

#_mysql身份运行要在当前目录写入socket文件, so write permissions to the group

$ sudo chmod g+w.

#sudo MySQL start is wrong because it goes to $path to find the MySQL command

$ sudo./mysql start

#检查是否运行

$ ps-u _mysql

#第一次登录空密码, the other is not very different from Linux.

$ bin/mysql-h 127.0.0.1-u root-p

#初始化 MySQL Root Password


./bin/mysqladmin-u Root Password 123456

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.