mysql version:mysql-5.6.11-debian6.0-i686.deb
os:ubuntu 13.04
安装条件: 1./etc/目录下面没有my.cnf、mysql文件夹, 如果有的话,请删除。2.data文件所有者应为mysql
安装过程:
sudo dpkg -i mysql-5.6.11-debian6.0-i686.deb //安装;MySQL server 被初始化在 /opt/mysql/server-5.6
groupadd mysql
//添加组mysql
useradd -r -g mysql mysql //把mysql用户添加到(后面的)mysql组中
cd /opt/mysql
chown -R root .
chgrp -R mysql .
sudo vim /etc/mysql/my.cnf //修改mysql的配置文件
//mycnf:set basedir=/opt/mysql/server-5.6,datadir=/opt/mysql/server-5.6/data,lc-messages-dir=/opt/mysql/server-5.6/share
cd server-5.6;
sudo scripts/mysql_install_db --user=mysql //初始化数据库
sudo cp support-files/mysql.server /etc/init.d/mysql //将mysql的启动shell程序放到系统服务目录下
sudo bin/mysqld_safe --user=mysql & //安全启动mysql,用于测试(有详细错误日志)
辅助:
sudo service mysql start //启动mysql(生产使用)
*sudo bin/mysql -u root -p [可选数据库名称] //测试是否可以登录 mysql
*sudo bin/mysqladmin -u root password [密码] //更改 mysql root 管理员密码[root初始密码为空]
*netstat -tl | grep mysql //查看mysql是否在监听端口命令
*ps -aux | grep mysqld //查看mysql是否启动命令
*mysqld_safe 直接kill(ps -ef|grep mysql;kill -s 9 pid).
安装过程中的错误:
//安装mysql workbench时缺少libctemplate0
*在http://ftp.br.debian.org/debian/pool/main/c/ctemplate/可下载
//while loading shared libraries: libaio.so.1:cannot open shared object file: No such file or directory
*安装libaio-dev
//files list file for package '包' missing;assuming package has no files currently installed.
*估计是依赖出错.运行apt-get autoclean,清理依赖关系;再apt-get install 依赖包;最好安装 dpkg -i mysql*.deb
//启动mysql 报错Can't find messagefile '/usr/share/mysql/errmsg.sys'
*修改/etc/mysql/my.cnf中的下面字段,设置正确的值
basedir =...
datadir=...
lc-messages-dir=...
//无法创建"/var/log/mysql/error.log":没有那个文件或目录
*sudo mkdir /var/log/mysql