`
tuhaitao
  • 浏览: 375420 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

MySQL-5.1.40 for linux 安装与部署

阅读更多
mysql-5.1.40-linux-i686-glibc23.tar.gz安装笔记:

1.首先添加mysql用户组
shell> groupadd mysql

2.添加mysql用户,并指定到mysql用户组
shell> useradd -g mysql mysql

3.解压缩mysql-version.tar.gz到安装目录(/usr/local/)
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -

4.为创建mysql软连接mysql-VERSION-OS
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql

5.设定mysql安装目录权限,设置owner为mysql
shell> chown -R mysql .

6.执行mysql系统数据库初始化脚本
shell> scripts/mysql_install_db --user=mysql

7.设定data目录权限,分配给mysql用户,为了mysql程序能读写data目录下的文件
shell> chown -R mysql data

8.使用mysql帐号启动mysql应用
shell> bin/mysqld_safe --user=mysql &

9.设置root密码
shell> bin/mysqladmin -u root password '123123'

10.登录mysql
shell> bin/mysql -u root -p
Enter password: 

登录成功会看到:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 229
Server version: 5.1.40-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 


这时mysql已经装好了,可以查看数据库了,但在正式使用数据库开发与部署的时候还需要做一些工作:


1.设定配置文件my.cnf

    按照需求copy my-***.cnf到/etc/my.cnf

2.修改默认字符集utf8

    (1).[client]下加入default-character-set=utf8
    (2).[mysqld]下加入default-character-set=utf8

3.设置默认存储引擎
     mysql for linux的版本默认使用的数据库引擎是MyISAM,但只有InnoDB引擎支持事务,
所以需要修改配置:

    (1).[mysqld]下加入default-storage-engine=INNODB

4.配置innodb参数
  

    (1).找到# Uncomment the following if you are using InnoDB tables
        去掉innodb_*下的所有#

    (2).如果安装mysql的目录不是默认的,则需要修改
        # mysql 默认安装目录为 /usr/local/mysql/
        # mysql 默认表空间目录安装目录为 /usr/local/mysql/data/

        innodb_data_home_dir=/usr/local/database/mysql/data/
        innodb_log_group_home_dir=/usr/local/database/mysql/data/

5.设置系统服务

    让linux启动的时候就启动mysql服务
shell> cd /usr/local/mysql/
shell> cp support-files/mysql.server /etc/init.d/mysql
shell> chmod 777 /etc/init.d/mysql 
shell> chkconfig --add mysql
shell> chkconfig --level 35 mysql on

6.重启MySQL服务
shell> service mysql restart
1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics