[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下都是使用原表名。
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下都是使用原表名。