linux下MySQL安装及设置(二)

MySQL二进制分发包安装

去MySql官网下MySQL classic版mysql-5.6.30-osx10.11-x86_64.tar.gz  http://dev.mysql.com/downloads/mysql/5.6.html

解压后重命名为mysql,并移到合适的位置。我放的位置为/data/service/mysql

cd /data/service/mysql
sudo chown -R mysql:mysql ./
sudo scripts/mysql_install_db --user=mysql
...
...//内容略
...
sudo chown -R root .
sudo chown -R mysql data

启动mysql

sudo ./bin/mysqld_safe

此时,shell窗口别关闭。

修改mysql的root账户的密码

开启另一个窗口

sudo ./bin/mysql_secure_installation
...//按提示,设置密码

mac版加入开机自启动

sudo vim /Library/LaunchDaemons/mysql56.plist

加入如下内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mysql56</string>
<key>Program</key>
<string>/data/service/mysql/bin/mysqld_safe</string>
<key>UserName</key>
<string>_mysql</string>
<key>WorkingDirectory</key>
<string>/data/service/mysql</string>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

也可这样启动停止:

sudo ./mysqld_safe
来启动mysql sudo ./mysql -u root -p
输入刚才设置的root密码来登录mysql sudo ./mysqld_safe stop
停止mysql

文章借鉴   mac下安装mysql :  http://blog.163.com/l_greatsea/blog/static/20498604420131275291368/

上一篇:纯html页面之间传参


下一篇:html5 canvas常用api总结(三)--图像变换API