zoukankan      html  css  js  c++  java
  • mysql数据库,如何进行数据目录的初始化操作

    需求描述:

      当将mysql的二进制包解压之后,只有通过初始化数据库的数据目录,创建系统表之后才能使用mysql Server

      数据库版本:5.5.57-log

    操作过程:

    1.通过解压之后的mysql包中scripts目录下的mysql_install_db脚本对DB进行初始化

    [mysql@redhat6 mysql]$ scripts/mysql_install_db --user=mysql   #通过--user=mysql来确定是使用哪个用户来初始化数据库,即通过哪个用户来运行数据库
    Installing MySQL system tables...  #安装Mysql的系统表
    180408  9:56:48 [Warning] option 'slow_query_log': boolean value '/mysql/data/log/slow-query.log' wasn't recognized. Set to OFF.
    180408  9:56:48 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set
    180408  9:56:48 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
    180408  9:56:48 [Note] /mysql/mysql/bin/mysqld (mysqld 5.5.57-log) starting as process 2722 ...
    180408  9:56:48 [Warning] You need to use --log-bin to make --binlog-format work.
    OK
    Filling help tables...  #增加help表
    180408  9:56:48 [Warning] option 'slow_query_log': boolean value '/mysql/data/log/slow-query.log' wasn't recognized. Set to OFF.
    180408  9:56:48 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set
    180408  9:56:48 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
    180408  9:56:48 [Note] /mysql/mysql/bin/mysqld (mysqld 5.5.57-log) starting as process 2729 ...
    180408  9:56:48 [Warning] You need to use --log-bin to make --binlog-format work.
    OK
    
    To start mysqld at boot time you have to copy
    support-files/mysql.server to the right place for your system
    
    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:
    
    /mysql/mysql/bin/mysqladmin -u root password 'new-password'  #为root用户设置密码
    /mysql/mysql/bin/mysqladmin -u root -h redhat6 password 'new-password'
    
    Alternatively you can run:
    /mysql/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.
    
    See the manual for more instructions.
    
    You can start the MySQL daemon with:
    cd /mysql/mysql ; /mysql/mysql/bin/mysqld_safe &
    
    You can test the MySQL daemon with mysql-test-run.pl
    cd /mysql/mysql/mysql-test ; perl mysql-test-run.pl
    
    Please report any problems at http://bugs.mysql.com/

    备注:在我的这个环境中,已经配置了/etc/my.cnf,里面设置datadir选项指明了将data目录存放的位置.

    小结:

      mysql_install_db脚本的作用就是初始化数据库,创建系统表.

    文档创建时间:2018年4月8日21:52:09

  • 相关阅读:
    大爽Python入门教程 0-2 什么是IDE?python选什么IDE好?
    大爽Python入门教程 0-3 安装Atom与配置Python环境
    大爽Python入门教程 0-1 安装python
    HBase 过滤器 及shell 操作过滤器
    分布式ID生成方式(雪花算法)
    tidb 踩坑经验(转载)
    MYSQL ACID
    kafka什么时候会丢消息
    java 单例模式模式实现
    使用 GitHub 的十个最佳实践
  • 原文地址:https://www.cnblogs.com/chuanzhang053/p/8747763.html
Copyright © 2011-2022 走看看