安装mysql-6.0.11-alpha过程

更新时间:2023-09-20 03:06:01 阅读量: 小学教育 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

安装mysql-6.0.11-alpha

先安装ncurses-5.7.tar.gz

# groupadd mysql # useradd -g mysql mysql

# tar xzvf mysql-6.0.11-alpha.tar.gz # cd mysql-6.0.11-alpha

# ./configure --prefix=/usr/local/mysql # make # make install

# cp support-files/my-medium.cnf /etc/my.cnf # cd /usr/local/mysql # chown -R mysql . # chgrp -R mysql .

# bin/mysql_install_db --user=mysql # chown -R root . # chown -R mysql var

# bin/mysqld_safe --user=mysql &

详解如下:

1)建立相应目录和组: # mkdir /usr/local/mysql # groupadd mysql

# useradd -g mysql mysql //useradd -g mysql -d /usr/local/mysql name

2)开始安装mysql

# tar xzvf mysql-6.0.11-alpha.tar.gz //

# cd mysql-6.0.11-alpha //

# ./configure --prefix=/usr/local/mysql \\ //--enable-thread-safe-client \\ //--without-debug \\ //--with-extra-charsets=gb2312 \\ //--enable-assembler \\ //--with-raid \\ --with-named-curses-libs=/usr/lib/libncursesw.so.5

解压缩 进入解压后的文件目录 设定安装目录

编译线程安全版的客户端库 关闭debug功能 添加gb2312中文字符支持 使用一些字符函数的汇编版本 //激活raid支持

# make //编译

# make install //安装

3)copy配置文件

有large,medium,small三个环境下的,根据机器性能选择,如果负荷比较大,可修改里面的一些变量的内存使用值

# cp support-files/my-medium.cnf /etc/my.cnf //复制配置文件

4)更改目录权限和组 # cd /usr/local/mysql # chown -R mysql . # chgrp -R mysql .

5)建立数据库和表

# bin/mysql_install_db --user=mysql //初始化授权

注:如果报以下错误

Installing MySQL system tables...

[ERROR] /usr/local/mysql/libexec/mysqld: unknown option '--skip-federated' [ERROR] Aborting

[Note] /usr/local/mysql/libexec/mysqld: Shutdown complete 只要将/etc/my.cnf文件中的skip-federated注释掉即可

6)再次更改目录权限和组 # chown -R root . # chown -R mysql var

7)启动MySQL服务

# bin/mysqld_safe --user=mysql &

//启动MySQL(The & character tells the operating system to run MySQL in the background; //it is ignored by MySQL itself.

//如果报错,注意及时查看/usr/local/mysql/var/下的日志文件)

8)设置MySQL启动服务

# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld

# chkconfig --add mysqld //在自动启动列表里添加mysqld # chkconfig --level 345 mysqld on

9)修改MySQL密码

# /usr/local/mysql/bin/mysqladmin -u root password 'new-password' //修改密码 # /usr/local/mysql/bin/mysqladmin -u root -h localhost password 'new-password'

// 将localhost替换成你的主机域名,比如:zhaorg.csu.edu.cn

10)登录mysql数据库:

# mysql -u root -p Enter password: root

Welcome to the MySQL monitor. Commands end with ; or \\g. Your MySQL connection id is 18 to server version: 5.0.19-log Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer. mysql> use mysql;

mysql>delete from user where password=\删除用于本机匿名连接的空密码帐号 mysql>flush privileges; mysql>quit

(或者,也可运行如下命令(Alternatively you can run): # /usr/local/mysql/bin/mysql_secure_installation

//which will also give you the option of removing the test //databases and anonymous user created by default. This is //strongly recommended for production servers.)

11)关闭MySQL服务

# /usr/local/mysql/bin/mysqladmin -u root -p new-password shutdown //关闭MySQL

本文来源:https://www.bwwdw.com/article/kkgh.html

Top