1. Download MySQL binary
2. Extract the binary, I put it at /usr/local
3. Create database
4. Set root password
5. Startup and shutdown
The instructions are for unix like system, even for Mac OS X.
With homebrew, it could be event easier. (Note: Homebrew is a third party software management tool for Mac OS X)
1. Make sure homebrew is working.
$ brew update
$ brew doctor
$ brew doctor
2. Install MySQL
$ brew install mysql
(mysql command will be installed in /usr/local/bin directory)
3. Create database
Make sure /usr/local/bin is in your PATH environment.
$ mysql_install_db [--basedir=/usr/local/Cellar/mysql/5.6.15]
Without the base dir, the system response with error can not find my.cnf file. The version number of the mysql could be different in your system, mine is 5.6.15.
4. setup my.cnf
$ vi /usr/local/Cellar/mysql/5.6.15/my.cnf
...
# These are commonly set, remove the # and set as required.
basedir = /usr/local/Cellar/mysql/5.6.15
datadir = /usr/local/data
port = 3306
server_id = 1
socket = /tmp/mysql.sock
...
...
# These are commonly set, remove the # and set as required.
basedir = /usr/local/Cellar/mysql/5.6.15
datadir = /usr/local/data
port = 3306
server_id = 1
socket = /tmp/mysql.sock
...
This is my configuration, you might have your own settings, especially for datadir.
5. Startup and shutdown
$ mysql.server start
Starting MySQL
. SUCCESS!
$ mysql.server stop
Starting MySQL
. SUCCESS!
$ mysql.server stop
6. Create root password
$ mysqladmin -u root [-h localhost] password 'new-password'
Once you have your root access to mysql, you can create other users and databases. Note: You need to start mysql server to change the root password.
No comments:
Post a Comment