centos下安装mysql5 打包版

[color=green][b]安装[/b][/color]
rpm需要yum才能运行,于是下载了taz的压缩版
安装步骤如下
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql & (启动)

关键点:创建mysql用户和组,解压,创建快捷方式(重要) 修改权限 导入初始表格

[b][color=green]设置密码[/color][/b]
mysqladmin -u root password 'newpassword' (输入的时候没有单引号)

[color=green][b]创建mysql自启动服务[/b][/color]
在MySQL目录下的support-file中,有一个叫myslq.server的启动脚本程序。把它复制到/etc/rc.d/init.d目录里面(改名为mysql):

# cd /etc/rc.d/init.d
# cp /usr/local/mysql/support-files/mysql.server mysql

接着把它的属性改为“x”(executable,可执行)

# chmod +x mysql

最后,运行chkconfig把MySQL添加到你系统的启动服务组里面去。

# /sbin/chkconfig --del mysql
# /sbin/chkconfig --add mysql

[color=green][b]远程连接权限[/b][/color]
进入mysql控制台 (./mysql -u root -p)
update user set host = '%' where user = 'root';

ps:我设置之后发现localhost无法进入,重新用远程ui给user中的localhost配了记录
(用户root 密码从%哪条抄下来) 后解决。

[color=green][b]服务器编码设置[/b][/color]
mysql默认编码是latin字符集,使用source命令导入中文数据有乱码问题。
按需要把某个my×.cnf拷贝到/etc/下(改名为my.cnf),在[mysqld]下加入default-character-set = utf8,[client]下加入default-character-set = utf8。
如果服务器在运行,需要重启。进入mysql控制台使用\s可以看到编码情况。

[color=green][b]windows中数据的迁移[/b][/color]
如果采用copy表文件的方式需要注意到是:
1.copy过去的表文件要设置权限,可以照着mysql库的权限来设置。
其中设置owner和所属组的代码为:
chown mysql *.*
chgrp mysql *.*
2.注意表名的问题,win下表名都被置为小写,而linux下都是使用原表名。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值