首页 > 数据库 > MySQL > 正文

MySQL 5 on Linux手动安装方法

2024-07-24 12:57:41
字体:
来源:转载
供稿:网友

1. 下载"MySQL-standard-5.0.27-linux-i686-icc-glibc23.tar.gz",推荐ICC版本,据称比GCC性能提高10-20%

2. 复制到/usr/local/,解压:tar zxvf mysql-standard-5.x....tar.gz

3. 添加用户和组mysql:

groupadd mysql

useradd -g mysql mysql

4. 创建符号连接:/usr/local # ln -s mysql-standard-5.x... mysql

5. cd mysql,当前目录改为/usr/local/mysql/

6. 运行脚步初始化数据库:./scripts/mysql_install_db --user=mysql

7. 设置权限:

/usr/local/mysql # chown -R root .

/usr/local/mysql # chown -R mysql data

/usr/local/mysql # chgrp -R mysql

8. 根据需要创建并修改/etc/my.cnf,参考配置:

[mysqld]

# 设置默认为INNODB表,支持事务:

default-storage-engine=INNODB

# 设置默认的字符集:

default-character-set=utf8

# 禁用bdb:
http://www.vevb.com
skip-bdb

9. 启动MySQL:

/usr/local/mysql/bin # ./mysqld_safe --user=mysql &

10. 初始化root口令:

/usr/local/mysql/bin # ./mysqladmin -u root -p passWord "password-of-root"

Enter password: <输入旧口令,直接按Enter>

11. 以root登录创建数据库:

/usr/local/mysql # ./mysql -u root -p

Enter password: password-of-root

创建一个新用户:

mysql> create user test identified by 'test-password';

创建一个新数据库:

mysql> create database testdb;

赋予test用户从localhost访问testdb的权限:

mysql> grant all on testdb.* to test@localhost;

停止MySQL服务器:

/usr/local/mysql/bin # ./mysqladmin -u root -p shutdown

Enter password: password-of-root

STOPPING server from pid file /usr/local/mysql/data/debian.pid

xxx mysqld ended

http://blog.csdn.net/asklxf/archive/2007/02/20/1512116.aspx


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表