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

  • 相关阅读:
    D. Time to Run【构造】
    P3388 割顶 【求割点个数】
    处女座的测验 素数,构造
    处女座与复读机 DP
    求一个分数小数点后指定位数的数字
    安卓开发创建活动,布局,添加按钮,she使用Toast,设菜单,使菜单相关联等操作
    三进制 处女座的砝码 高精度
    上海高校程序设计联赛 D-CSL的字符串 栈模拟
    区间DP经典 石子合并
    区间DP 洛谷P2858牛奶零食
  • 原文地址:https://www.cnblogs.com/chuanzhang053/p/8747763.html
Copyright © 2011-2022 走看看