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的系统表
:: [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数据库,如何进行数据目录的初始化操作的更多相关文章
- MySQL数据库(6)_用户操作与权限管理、视图、存储过程、触发器、基本函数
用户操作与权限管理 MySQL用户操作 创建用户 方法一: CREATE USER语句创建 CREATE USER "用户名"@"IP地址" IDENTIFIE ...
- Django中使用mysql数据库并使用原生sql语句操作
Django自身默认使用sqlite3这个轻量级的数据库,但是当我们开发网站时,sqlite3就没有mysql好,sqlite3适合一些手机上开发使用的数据库. 准备的软件mysql数据库,版本5.7 ...
- MySQL数据库(2)- 库的操作、表的操作、数据的操作、存储引擎的介绍
一.库的操作 1.系统数据库 执行如下命令,查看系统数据库: mysql> show databases; 参数解释: information_schema: 虚拟库,不占用磁盘空间,存储的是数 ...
- 【Python + Mysql】之用pymysql库连接Mysql数据库并进行增删改查操作
用pip下载pymysql并引用 具体请参考文章: <Python之MySQL数据库增删改查操作> <python3.6 使用 pymysql 连接 Mysql 数据库及 简单的增删 ...
- MySQL数据库(二)--库相关操作、表相关操作(1)、存储引擎、数据类型
一.库相关操作 1.创建数据库 (1)语法 create database 数据库 charset utf8; (2)数据库命名规范 可以由字母.数字.下划线.@.#.$ 区分大小写 唯一性 不能使用 ...
- MySQL数据库(二)——库相关操作、表相关操作(一)、存储引擎、数据类型
库相关操作.表相关操作(一).存储引擎.数据类型 一.库相关操作 1.创建数据库 (1)语法 create database 数据库 charset utf8; (2)数据库命名规范 可以由字母.数字 ...
- 48.Python中ORM模型实现mysql数据库基本的增删改查操作
首先需要配置settings.py文件中的DATABASES与数据库的连接信息, DATABASES = { 'default': { 'ENGINE': 'django.db.backends.my ...
- php之PDO连接mysql数据库,增删改查等等操作实例
我们使用传统的 mysql_connect .mysql_query方法来连接查询数据库时,如果过滤不严就有SQL注入风险,导致网站被攻击. 虽然可以用mysql_real_escape_string ...
- java连接mysql数据库 三 实现增删改查操作
同以前一样,先写一个数据库打开和关闭操作类 public class DBConnection { String driver = "com.mysql.jdbc.Driver"; ...
随机推荐
- ny523 亡命逃串 hdoj 1253胜利大逃亡
亡命逃窜 时间限制:1000 ms | 内存限制:65535 KB 难度:4 描述 从前有个叫hck的骑士,为了救我们美丽的公主,潜入魔王的老巢,够英雄吧.不过英雄不是这么好当的.这个可怜的娃被魔 ...
- VS2012, opencv2.4.4环境搭建
2.1 环境准备 安装 Visual Studio 2012 下载 opencv 最新版本( 目前是2.4.6, 下载链接 ) 2.2 安装 opencv 2.2.1. 双击下载的 OpenCV-2. ...
- IOC疑惑
转载自:http://www.tuicool.com/articles/QfeEFn 大家好. 今天我来给大家扯扯IoC,以及StructureMap的一些简单应用(基本用法.自动装配.生命周期.延迟 ...
- 在django中访问静态文件(js css img)
刚开始参考的是别的文章,后来参考文章<各种 django 静态文件的配置总结>才看到原来没有但是没有注意到版本,折腾了一晚上,浪费了很多很多时间.后来终于知道搜索django1.7访问静态 ...
- const在c和c++中地位不同
先测试C语言的const: #include<stdio.h> int main() { ; //等价于 //int const a = 10; //a = 11;//err ; cons ...
- TextBox控件设置ReadOnly=true后台取不到值三种解决方法(转)
当TextBox设置了ReadOnly=true后要是在前台为控件添加了值,后台是取不到的,值为空,多么郁闷的一个问题经过尝试,发现可以通过如下的方式解决这个问题.感兴趣的朋友可以了解下当TextBo ...
- c#简单写售票系统
原理: 先生成一个9行4列的数组,然后用一个输入的值(坐标)去替换掉座位 代码: using System; using System.Collections.Generic; using Syste ...
- 【C#】解析XML
最近在尝试用WPF搞点桌面小应用. C#中使用System.Xml.XmlDocument类对XML文件进行操作. 文档详情如下: https://msdn.microsoft.com/en-us/l ...
- python-can 的使用
最近在搞 websocket, 服务端是用 python 写的,所以,我需要用python 控制 can 去传输相关信息. python-can 模块就是 python 控制 can 的模仿. 利用 ...
- QT 5.7.0 交叉编译记录
这一篇记录 Qt 5.x cross-compiler with eglfs , 平台是 TI-AM3354, 上一篇SGX的移植就是为了这一次的交叉编译. 一. 下载QT的源码: 地址: http: ...