1)下载:
mysql-5.6.13-debian6.0-x86_64.deb
http://dev.mysql.com/downloads/mirror.php?id=413956
2)安装:
$ sudo dpkg -i mysql-5.6.3-debian6.0-x86_64.deb
Mysql Server 初始化在:/opt/mysql/server-5.6
3)配置:
$ sudo groupadd mysql
$ sudo useradd -r -g mysql mysql
$ sudo apt-get install libaio-dev # 这个不知道有什么用
$ sudo ln -s /opt/mysql/server-5.6 /usr/local/mysql
$ sudo mkdir /usr/local/mysql/data
$ sudo chown -R mysql. /usr/local/mysql/data
[plain] view plain copy print ?
# 初始化数据库
$ sudo /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
# 将mysqld的启动shell放到系统服务目录下:
$ sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
#将mysql的配置文件放到系统配置下/etc/, mysql在全局范围内使用这个配置文件:
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
pid-file=/var/run/mysqld/mysqld.pid
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
$ sudo cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
4) 启动/停止 Mysql
$ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/mysql stop
5) 更改mysql root管理员密码为 abc. 强烈建议开发的机器密码: root
$ sudo /usr/local/mysql/bin/mysqladmin -u root password abc
6) 登录到mysql (启动之后)
$ sudo /usr/local/mysql/bin/mysql -u root -p <数据库名>
# 或者
$ sudo /usr/local/mysql/bin/mysql -u root
# 显示数据库 > show databases;
# 使用数据库> use 数据库名;
#显示全部表>show tables;