需求描述:

  当将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的系统表
:: [Warning] option 'slow_query_log': boolean value '/mysql/data/log/slow-query.log' wasn't recognized. Set to OFF.
:: [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
:: [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
:: [Note] /mysql/mysql/bin/mysqld (mysqld 5.5.-log) starting as process ...
:: [Warning] You need to use --log-bin to make --binlog-format work.
OK
Filling help tables... #增加help表
:: [Warning] option 'slow_query_log': boolean value '/mysql/data/log/slow-query.log' wasn't recognized. Set to OFF.
:: [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
:: [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
:: [Note] /mysql/mysql/bin/mysqld (mysqld 5.5.-log) starting as process ...
:: [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

mysql数据库,如何进行数据目录的初始化操作的更多相关文章

  1. MySQL数据库(6)_用户操作与权限管理、视图、存储过程、触发器、基本函数

    用户操作与权限管理 MySQL用户操作 创建用户 方法一: CREATE USER语句创建 CREATE USER "用户名"@"IP地址" IDENTIFIE ...

  2. Django中使用mysql数据库并使用原生sql语句操作

    Django自身默认使用sqlite3这个轻量级的数据库,但是当我们开发网站时,sqlite3就没有mysql好,sqlite3适合一些手机上开发使用的数据库. 准备的软件mysql数据库,版本5.7 ...

  3. MySQL数据库(2)- 库的操作、表的操作、数据的操作、存储引擎的介绍

    一.库的操作 1.系统数据库 执行如下命令,查看系统数据库: mysql> show databases; 参数解释: information_schema: 虚拟库,不占用磁盘空间,存储的是数 ...

  4. 【Python + Mysql】之用pymysql库连接Mysql数据库并进行增删改查操作

    用pip下载pymysql并引用 具体请参考文章: <Python之MySQL数据库增删改查操作> <python3.6 使用 pymysql 连接 Mysql 数据库及 简单的增删 ...

  5. MySQL数据库(二)--库相关操作、表相关操作(1)、存储引擎、数据类型

    一.库相关操作 1.创建数据库 (1)语法 create database 数据库 charset utf8; (2)数据库命名规范 可以由字母.数字.下划线.@.#.$ 区分大小写 唯一性 不能使用 ...

  6. MySQL数据库(二)——库相关操作、表相关操作(一)、存储引擎、数据类型

    库相关操作.表相关操作(一).存储引擎.数据类型 一.库相关操作 1.创建数据库 (1)语法 create database 数据库 charset utf8; (2)数据库命名规范 可以由字母.数字 ...

  7. 48.Python中ORM模型实现mysql数据库基本的增删改查操作

    首先需要配置settings.py文件中的DATABASES与数据库的连接信息, DATABASES = { 'default': { 'ENGINE': 'django.db.backends.my ...

  8. php之PDO连接mysql数据库,增删改查等等操作实例

    我们使用传统的 mysql_connect .mysql_query方法来连接查询数据库时,如果过滤不严就有SQL注入风险,导致网站被攻击. 虽然可以用mysql_real_escape_string ...

  9. java连接mysql数据库 三 实现增删改查操作

    同以前一样,先写一个数据库打开和关闭操作类 public class DBConnection { String driver = "com.mysql.jdbc.Driver"; ...

随机推荐

  1. linux命令(29):用户组管理

    用户管理: 新建用户或组:新建用户:adduser user //新建user用户(推荐)passwd user //给user用户设置密码 新建组:groupadd test //新建test工作组 ...

  2. 通过命令来查看NameNode的状态(是Active还是Standby)

    通过浏览器虽然可以查看HDFS的NameNode的状态,如果感觉不方便,可以直接使用命令来查看(前提是HDFS已经启动): [root@hadoop01 ~]# hdfs haadmin -getSe ...

  3. linux 查看文件占用的大小

    du  --max-depth=1 -h /usr/local/tomcat_bjtu2/bin/*         文件路径 du -sh * | sort -nr | head du -sh *

  4. Java Web开发中用Tomcat部署项目的三种方法

    第一种方法:在tomcat中的conf目录中,在server.xml中的,<host/>节点中添加: <Context path="/hello" docBase ...

  5. cmder小技巧

    1.修改config下的aliases文件,可以添加别名 $* 表示所有参数,$i 表示第几个参数 比如cd cd=cd /d $* 这样window下的cd就可以直接切换盘符+路径了. 有用的别名 ...

  6. LeetCode103 BinaryTreeZigzagLevelOrderTraversal(二叉树Z形层次遍历) Java题解

    题目: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from lef ...

  7. nginx 405 not allowed问题的解决

    转载自:  http://www.linuxidc.com/Linux/2012-07/66761.htm Apache.IIS.Nginx等绝大多数web服务器,都不允许静态文件响应POST请求,否 ...

  8. BusyBox inittab

    # /etc/inittab init(8) configuration for BusyBox## Copyright (C) 1999-2004 by Erik Andersen <ande ...

  9. Portal故障定位思路

  10. window上将MongoDB的启动加入到服务中

    在系统管理员的命令行模式中: 进入mongo的安装目录,参照如下: 其中: --dbpath为保存的数据的路径 mongod --bind_ip --serviceName "MongoDB ...