设为首页收藏本站

UNIX技术社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
热搜: console
查看: 15472|回复: 0

对于创建数据目录来说MySQL 5.6版本太繁琐

[复制链接]
发表于 2012-8-24 20:09:59 | 显示全部楼层 |阅读模式
本帖最后由 sweat 于 2012-8-24 20:20 编辑

    当我使用MySQL测试区安装一个MySQL包时,如果一切进行顺利,我会在标准输出上得到一个提示消息,然后继续操作。

    下面这些是正确的做法

    当前目录下:

    $HOME/opt/mysql/5.5.15/scripts/mysql_install_db --no-defaults \
      --user=$USER --basedir=$HOME/opt/mysql/5.5.15 \
      --datadir=$HOME/sandboxes/msb_5_5_15/data \
      --lower_case_table_names=2
    Installing MySQL system tables...(安装MySQL系统表)
    OK
    Filling help tables...(填补帮助表)
    OK

    要想在引导时启动mysql,你必须对您的系统复制support-files/mysql.server到正确的地方。

    请记住为MySQL root用户设置的密码!

    要想这么做,先启动服务器,然后发出以下命令:

    /Users/gmax/opt/mysql/5.5.15/bin/mysqladmin -u root password 'new-password'
    /Users/gmax/opt/mysql/5.5.15/bin/mysqladmin -u root -h gmac4.local password 'new-password'

    或者您可以运行:

    /Users/gmax/opt/mysql/5.5.15/bin/mysql_secure_installation

    这也会提示您一个删除测试默认创建的数据库和匿名用户的选项。我极力推荐生产服务器。

    请参阅更多操作指南手册。

    你可以启动MySQL守护进程:

    cd /Users/gmax/opt/mysql/5.5.15 ; /Users/gmax/opt/mysql/5.5.15/bin/mysqld_safe
    You can test the MySQL daemon with mysql-test-run.pl
    cd /Users/gmax/opt/mysql/5.5.15/mysql-test ; perl mysql-test-run.pl

    请将问题报告给/Users/gmax/opt/mysql/5.5.15/scripts/mysqlbug脚本。

    其实我很有信心地可以制止输出,如果程序出现错误,我的屏幕会有所显示。例如,如果我尝试安装到一个被写保护的数据目录下,我会得到如下:

    chmod 444 $HOME/sandboxes/msb_5_5_15/data
    $HOME/opt/mysql/5.5.15/scripts/mysql_install_db --no-defaults \
      --user=$USER --basedir=$HOME/opt/mysql/5.5.15 \
      --datadir=$HOME/sandboxes/msb_5_5_15/data \
      --lower_case_table_names=2  > /dev/null
    mkdir: /Users/gmax/sandboxes/msb_5_5_15/data: Permission denied
    chmod: /Users/gmax/sandboxes/msb_5_5_15/data: Permission denied
    chown: /Users/gmax/sandboxes/msb_5_5_15/data: Permission denied

    这一办法,我知道有些错误,这是非常清晰可读的。我并不需要由常用的消息来捕获它。标准错误是一个单独的的文件描述符,它可以独立地从标准输入中读取。

    在修改权限后:

    chmod 755 ~/sandboxes/msb_5_5_15/
    $HOME/opt/mysql/5.5.15/scripts/mysql_install_db --no-defaults \
      --user=$USER --basedir=$HOME/opt/mysql/5.5.15 \
      --datadir=$HOME/sandboxes/msb_5_5_15/data \
      --lower_case_table_names=2  > /dev/null
    # empty line: means all OK

    这是非常方便的,并且也是Unix系统的使用方法。

    下面这些是不正确的做法

    现在让我们同样用MySQL 5.6版本来进行操作。

    $BASEDIR/scripts/mysql_install_db --no-defaults --user=tungsten \
      --basedir=$BASEDIR --datadir=/home/tungsten/sandboxes/msb_5_6_4/data \
      --tmpdir=/home/tungsten/sandboxes/msb_5_6_4/tmp  > /dev/null
    InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
    InnoDB: Compressed tables use zlib 1.2.3
    InnoDB: Using Linux native AIO
    InnoDB: CPU supports crc32 instructions     
InnoDB: Initializing buffer pool, size = 128.0M
    InnoDB: Completed initialization of buffer pool
    InnoDB: The first specified data file ./ibdata1 did not exist:
    InnoDB: a new database to be created!
    InnoDB: Setting file ./ibdata1 size to 10 MB
    InnoDB: Database physically writes the file full: wait...
InnoDB: Log file ./ib_logfile0 did not exist: new to be created
    InnoDB: Setting log file ./ib_logfile0 size to 5 MB
    InnoDB: Database physically writes the file full: wait...
    InnoDB: Log file ./ib_logfile1 did not exist: new to be created
    InnoDB: Setting log file ./ib_logfile1 size to 5 MB
    InnoDB: Database physically writes the file full: wait...
    InnoDB: Doublewrite buffer not found: creating new
    InnoDB: Doublewrite buffer created
    InnoDB: 128 rollback segment(s) are active.
    InnoDB: Creating foreign key constraint system tables
    InnoDB: Foreign key constraint system tables created
    InnoDB: 1.2.4 started; log sequence number 0

    [警告] 信息表没有准备好被使用。无法打开表'mysql.slave_master_info’。

    [警告] 复制元数据的同时,检查错误。设置请求库,以便向用户提供解决这个问题的机会,并重新启动服务器。如果这是一个激活的升级,请考虑使用mysql_upgrade来解决这个问题。

    [警告] 信息表没有准备好被使用。无法打开表‘mysql.slave_relay_log_info’。

    [警告] 复制元数据的同时,检查错误。设置请求库,以便向用户提供解决这个问题的机会,并重新启动服务器。如果这是一个激活的升级,请考虑使用mysql_upgrade来解决这个问题。

    [Note] Binlog end
    [Note] Shutting down plugin 'partition'
    [Note] Shutting down plugin 'ARCHIVE'
    [Note] Shutting down plugin 'BLACKHOLE'
    [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
    [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
    [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
    [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
    [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
    [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
    [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
    [Note] Shutting down plugin 'INNODB_SYS_TABLES'
    [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
    [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
    [Note] Shutting down plugin 'INNODB_FT_CONFIG'
    [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
    [Note] Shutting down plugin 'INNODB_FT_DELETED'
    [Note] Shutting down plugin 'INNODB_FT_INSERTED'
    [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
    [Note] Shutting down plugin 'INNODB_METRICS'
    [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
    [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
    [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
    [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
    [Note] Shutting down plugin 'INNODB_CMPMEM'
    [Note] Shutting down plugin 'INNODB_CMP_RESET'
    [Note] Shutting down plugin 'INNODB_CMP'
    [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
    [Note] Shutting down plugin 'INNODB_LOCKS'
    [Note] Shutting down plugin 'INNODB_TRX'
    [Note] Shutting down plugin 'InnoDB'
    InnoDB: FTS optimize thread exiting.
    InnoDB: Starting shutdown...
    InnoDB: Shutdown completed; log sequence number 1602841
    [Note] Shutting down plugin 'CSV'
    [Note] Shutting down plugin 'MEMORY'
    [Note] Shutting down plugin 'MyISAM'
    [Note] Shutting down plugin 'MRG_MYISAM'
    [Note] Shutting down plugin 'mysql_old_password'
    [Note] Shutting down plugin 'mysql_native_password'
    [Note] Shutting down plugin 'binlog'
    InnoDB: The InnoDB memory heap is disabled
    InnoDB: Mutexes and rw_locks use GCC atomic builtins
    InnoDB: Compressed tables use zlib 1.2.3
    InnoDB: Using Linux native AIO
    InnoDB: CPU supports crc32 instructions
    InnoDB: Initializing buffer pool, size = 128.0M
    InnoDB: Completed initialization of buffer pool
    InnoDB: highest supported file format is Barracuda.
    InnoDB: 128 rollback segment(s) are active.
    InnoDB: Waiting for the background threads to start
    InnoDB: 1.2.4 started; log sequence number 1602841
    [Note] Binlog end
    [Note] Shutting down plugin 'partition'
    [Note] Shutting down plugin 'ARCHIVE'
    [Note] Shutting down plugin 'BLACKHOLE'
    [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
    [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
    [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
    [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
    [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
    [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
    [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
    [Note] Shutting down plugin 'INNODB_SYS_TABLES'
    [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
    [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
    [Note] Shutting down plugin 'INNODB_FT_CONFIG'
    [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
    [Note] Shutting down plugin 'INNODB_FT_DELETED'
    [Note] Shutting down plugin 'INNODB_FT_INSERTED'
    [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
    [Note] Shutting down plugin 'INNODB_METRICS'
    [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
    [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
    [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
    [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
    [Note] Shutting down plugin 'INNODB_CMPMEM'
    [Note] Shutting down plugin 'INNODB_CMP_RESET'
    [Note] Shutting down plugin 'INNODB_CMP'
    [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
    [Note] Shutting down plugin 'INNODB_LOCKS'
    [Note] Shutting down plugin 'INNODB_TRX'
    [Note] Shutting down plugin 'InnoDB'
    InnoDB: FTS optimize thread exiting.
    InnoDB: Starting shutdown...
    InnoDB: Shutdown completed; log sequence number 1602851
    [Note] Shutting down plugin 'CSV'
    [Note] Shutting down plugin 'MEMORY'
    [Note] Shutting down plugin 'MyISAM'
    [Note] Shutting down plugin 'MRG_MYISAM'
    [Note] Shutting down plugin 'mysql_old_password'
    [Note] Shutting down plugin 'mysql_native_password'
    [Note] Shutting down plugin 'binlog'

    为什么这不好?因为你你看都不看一眼什么是对什么是错的地方。所有上述消息被打印到应保留的标准错误表里,如果标准错误是以常规消息的方式使用的话,那么你可能会错过重要的错误信息提示,而不是混合了“一切正常”的消息报告。

    这个Bug#60934是有关此问题的提出,但它已被认为是一个功能要求,所以这个文档不是规定好的,随时要做变动。

    在上述案文中,还有更多的内容在其中。比如说,有警告,混合使用的标准文本,这都告诉我是不是在一个固定位置修改的错误,,如复制元数据和slave_master_info的引导操作。

    MySQL开发者,请解决这个问题。当有错误发现时,用户需要错误报告,和警告或错误信息有关的内容,其实这些都是可以修改的内容。其实MySQL5.6继承了GA,这个问题最终会被大家解决的。
mysql-5.5.27部署.rar (4.35 KB, 下载次数: 173)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表