Home > Database > Mysql Tutorial > body text

Mysql配置技巧

WBOY
Release: 2016-06-07 15:13:56
Original
1003 people have browsed it

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 注:以下操作在Redhat 2.6.9 + mysql-standard-4.1.8-pc-linux-i686上验证通过 1. Redhat上Mysql配置 1.1 以root身份登录Redhat系统,配置mysql服务,注意将其中的路径改为实际路径 Shelltar -zxvf m

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

  注:以下操作在Redhat 2.6.9 + mysql-standard-4.1.8-pc-linux-i686上验证通过

  1. Redhat上Mysql配置

  1.1 以root身份登录Redhat系统,配置mysql服务,注意将其中的路径改为实际路径

  Shell>tar -zxvf mysql-standard-4.1.8-pc-linux-i686.tar.gz

  Shell>mv mysql-standard-4.1.8-pc-linux-i686 ../mysql

  Shell>cd ..

  Shell>groupadd mysql

  Shell>useradd -g mysql mysql

  Shell>scrīpts/mysql_install_db --user=mysql

  Shell>chown -R mysql:mysql ./mysql

  Shell>cp /home/fenet/my.cnf /etc

  Shell>cd /usr/local

  Shell>ln -s /home/fenet/mysql mysql

  1.2 启动mysql服务

  Shell>cd /usr/local/mysql/bin

  Shell>./mysqld_safe &

  1.3 确认mysql服务启动完成

  Shell>netstat -an|grep 3306

  1.4 停止mysql服务

  Shell>cd /usr/local/mysql/bin

  Shell>./mysqladmin shutdown

  2. Mysql上创建数据库及用户授权

  mysql>drop database if exists `Database`;

  mysql>create database Database DEFAULT CHARACTER SET GBK;

  mysql>use Database;

  mysql>GRANT ALL PRIVILEGES ON Database.* TO Username@"%" IDENTIFIED BY 'Password' WITH GRANT OPTION;

  mysql>GRANT ALL PRIVILEGES ON Database.* TO Username@"localhost" IDENTIFIED BY 'Password' WITH GRANT OPTION;

  mysql>update mysql.user set password = OLD_PASSWORD('Password') where user = 'Username';

  mysql>flush privileges;

  3.Mysql 实用的数据备份及回复方式

  # 备份指定的mysql数据库

  mysqldump --user=Username --password=Password --host=Hostname --port=PortNumber --default-character-set=gbk  DatabaseName > DBDump.sql

  # 将mysqldump的数据脚本还原到指定的mysql数据库

  mysql --host=Hostname --user=Username --password=Password --database=DatabaseName

  4. Windows下mysql服务注册及删除

  mysqld-nt --install --defaults-file=

  mysqld-nt --remove

Mysql配置技巧

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template