前期准备:
检查系统资源
内存大小
# grep MemTotal/proc/meminfo
统一为:
Ubuntu 12.04.1 LTS(GNU/Linux 3.2.0-29-generic x86_64)
Pingwww.baidu.com
Date
vi/etc/sysconfig/iptables
-ARH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306-j ACCEPT
重启
/etc/init.d/iptables restart
[root]# sudoapt-get install mysql-server
注意:apt-get安装的数据版本应该为5.5.34
[root]#vim/etc/mysql/my.cnf
###[mysqld]添加以下项
character_set_server=utf8
skip-name-resolve
skip-external-locking
#如果是数据库专用服务器innodb_buffer_pool_size为物理内存的60%-70%
innodb_file_per_table
innodb_data_file_path= ibdata1:300M:autoextend
innodb_buffer_pool_size=
innodb_log_file_size= 512M
innodb_log_buffer_size= 10M
修改后保存配置并重启数据库
**由于改了innodb的配置,需要把/var/lib/mysql下的ibdata1、ib_logfile*删除
[root]#rm –f/var/lib/mysql/ib*
[root]#servicemysql restart
#配置程序连接权限
[root]#mysql–uroot -p
mysql>GRANT ALL ON*.* TO 'leroy'@'%' IDENTIFIED BY '123456';
#配置只读权限
mysql>GRANTselect ON *.* TO 'read_only'@'%' IDENTIFIED BY '123456';
mysql>flushPRIVILEGES;
[root]#mysql–uroot -p
#创建数据库customerTest
mysql>createdatabse customerTest;
#把/home/mysql/customer01.sql导入到customerTest
mysql>source/home/mysql/ customer01.sql
#或使用以下命令把/home/mysql/customer01.sql导入到customerTest
mysql–uroot –p customerTest < /home/mysql/ customer01.sql
[root]#mysqldump -uroot -p --optcustomerTest >/home/mysql/customer01.sql
#关闭
[root]#servicemysql stop
#启动
[root]#servicemysql start
#重启
[root]#servicemysql restart
#开启/关闭general_log/查看日志的路径
mysql>show variables like '%general_log%'
mysql>setglobal log = ON
mysql>setglobal log = OFF
#开启/关闭SLOW日志
mysql>show variables like '%slow%'
#打开SLOW日志
mysql>setglobal log_slow_queries =ON
#抓取1秒以上的的SQL记录
mysql>set global slow_launch_time=1
mysql>setglobal log = OFF
Navicat for MySQL
Workbench
MySqlYog
phpMyAdmin
可参考www.mysql.com
参考推荐:
http://blog.csdn.net/ithomer/article/details/6855745(三种安装方式,离线)
http://www.cnblogs.com/eastson/archive/2012/06/09/2543489.html
http://blog.csdn.net/ithomer/article/details/6856358