Centos7上修改mysql数据目录
- 通过yum安装的mysql,启动和增加数据库,增加数据如下:
- [root@wucl-4 lib]# systemctl start mariadb
- [root@wucl-4 lib]# mysql -uroot
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 2
- Server version: 5.5.52-MariaDB MariaDB Server
- Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | abc |
- | mysql |
- | performance_schema |
- | test |
- +--------------------+
- 5 rows in set (0.00 sec)
- MariaDB [(none)]> use abc;
- Reading table information for completion of table and column names
- You can turn off this feature to get a quicker startup with -A
- Database changed
- MariaDB [abc]> show tables;
- +---------------+
- | Tables_in_abc |
- +---------------+
- | abc |
- +---------------+
- 1 row in set (0.00 sec)
- MariaDB [abc]> select * from abc;
- +------+---------+
- | id | name |
- +------+---------+
- | 1 | baoshan |
- +------+---------+
- 1 row in set (0.00 sec)
- MariaDB [abc]> show variables like 'datadir%';
- +---------------+-----------------+
- | Variable_name | Value |
- +---------------+-----------------+
- | datadir | /var/lib/mysql/ |
- +---------------+-----------------+
- 1 row in set (0.01 sec)
- 现在将mysql数据目录换成/var/lib/mysql8
- 操作步骤如下:
- 1. 停止数据库systemctl start mariadb
- 2. 修改配置文件/etc/my.conf
- [mysqld]
- datadir=/var/lib/mysql8
- socket=/var/lib/mysql8/mysql.sock
- 3. 新建mysql8文件夹,将mysql原数据目录中的文件复制到mysql8目录中
- [root@wucl-4 lib]# pwd
- /var/lib
- [root@wucl-4 lib]# mkdir mysql8
- [root@wucl-4 lib]# cp -rf mysql/* mysql8/
- 4. 修改mysql8目录的所属用户和组
- chown -R mysql:mysql mysql8/
- 5. 启动mysql数据库
- systemctl start mariadb
- 6. 访问数据库,查看数据时候迁移成功,查看现在数据目录
- [root@wucl-4 lib]# mysql -uroot -S /var/lib/mysql8/mysql.sock
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 2
- Server version: 5.5.52-MariaDB MariaDB Server
- Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | abc |
- | mysql |
- | performance_schema |
- | test |
- +--------------------+
- 5 rows in set (0.00 sec)
- MariaDB [(none)]> use abc;
- Reading table information for completion of table and column names
- You can turn off this feature to get a quicker startup with -A
- Database changed
- MariaDB [abc]> show tables;
- +---------------+
- | Tables_in_abc |
- +---------------+
- | abc |
- +---------------+
- 1 row in set (0.00 sec)
- MariaDB [abc]> select * from abc;
- +------+---------+
- | id | name |
- +------+---------+
- | 1 | baoshan |
- +------+---------+
- 1 row in set (0.00 sec)
- MariaDB [abc]> show variables like 'datadir%';
- +---------------+------------------+
- | Variable_name | Value |
- +---------------+------------------+
- | datadir | /var/lib/mysql8/ |
- +---------------+------------------+
- 1 row in set (0.00 sec)
- 前后折腾了好久,mark一下。
Centos7上修改mysql数据目录的更多相关文章
- 在 CentOS7 上部署 MySQL 主从
在 CentOS7 上部署 MySQL 主从 通过 SecureCRT 连接至 MySQL 主服务器: 找到 my.cnf 文件所在的目录: mysql --help | grep my.cnf 一般 ...
- centos7上修改主机名
centos7上修改主机名 2017-10-09 13:45:17 个人原创,转载请注明,否则追究法律责任 1,临时修改: 和centos5,centos6 一样,重启失效 2,永久修改: 命令: ...
- centos7上安装 mysql
centos7上的安装是和其他的版本不一样的 ,因为centos上的安装与centos的操作是不通了的 在CentOS中默认安装有MariaDB,这个是MySQL的分支,但为了需要,还是要在系统中安装 ...
- Centos7 上安装mysql遇上的问题:mysql无法正常启动
第一次在Centos上安装mysql遇到的一些问题. 第一步就遇到问题,安装mysql-server报错没有可用包. [解决方法] 先要安装mysql # wget http://repo.mysq ...
- 阿里云CentOs7上安装Mysql
前提:虽然yum源上有mysql,但是好像没有mysql-server,所以我们还是选择自己从官网上下载安装 一.新建文件夹,然后下载解压 cd /usr/ #新建mysql文件夹 mkdir mys ...
- linux上修改mysql登陆密码
1. 修改MySQL的登录设置: # vi /etc/my.cnf 2. 在[mysqld]的段中加上一句:skip-grant-tables 例如: [mysqld] port ...
- Mac上修改MySQL默认字符集为utf8
1.检查默认安装的mysql的字符集 mysql> show variables like '%char%'; +--------------------------+------------- ...
- 远程连接centos7 上的mysql报(ERROR 2003 (HY000): Can't connect to MySQL server on '168.x.x.x' (10060) )
1.MySQL端口 因为上一篇文章我就已经给MySQL新建了一新用户,且赋予了远程连接数据库的所有权限(GRANT ALL PRIVILEGES ON *.* TO 'newuser' @ '%' I ...
- CentOS7 上安装 MySQL 5.7
1.下载如下rpm文件: mysql-community-common-5.7.17-1.el7.x86_64.rpm mysql-community-libs-5.7.17-1.el7.x86_64 ...
随机推荐
- 对于Ian的访谈,不少关于GAN的内容
文章链接如下: http://3g.163.com/dy/article/DD1GBSLF0511ABV6.html 里面提到胶囊网络,我找了这篇文章看了下: https://blog.csdn.ne ...
- 再谈JavaScript的数据类型问题
JavaScript的数据类型问题已经讨论过很多次了,但许多人还有许多书仍然沿用着错误的.混乱的一些观点,所以就再细讲一回. 提及这个讨论的原因在于argb同学在我的MSN博客上的一段回复,又更早的起 ...
- python 相似语句匹配(非机器学习)
#coding=utf-8 import xlrd import distance from sklearn.feature_extraction.text import CountVectorize ...
- [JS Compose] 7. Ensure failsafe combination using monoids
monoids is a semi-group with a neutral element. A semigroup, it does not have an element to return s ...
- Dreamweaver界面主要菜单功能介绍
启动界面有四个功能:主要使用新建HTML,其中HTML有很多版本,由于国内IE6.0占据了将近百分之七十的比例,所以最新的HTML1.1对他支持的不好,我们主要使用XHTML 1.0 Transiti ...
- 导入exce表格中的数据l到数据库
因为我的项目是JavaWeb的,所有是通过浏览器导入数据库到服务器端的数据库,这里我们采用struts来帮助我们完成. 1:首先定义一个文件上传的jsp页面.把我们的数据先上传到服务器端. <f ...
- 显示游戏FPS帧率的几种计算方式
FPSDisplay.cs using UnityEngine; using System.Collections; public class FPSDisplay : MonoBehaviour { ...
- 基于JUnit3.8的一个简单的测试程序
实现一个简单的计算 注:目标类和测试类要放在同一包下, JUnit单元测试基础要点 目标类:Calculator.java package com.junit3_8; public class Cal ...
- Unity3D入门工具介绍(一)
1.UnitySetup-4.1.2.exe安装包 2unity.pro.4.1.2.patch-MPT.exeUnity3D破解补丁 关于Unity3d 可以看下这个 http://book.2c ...
- [转发]MVC WebAPI get和post请求
转自:http://www.cnblogs.com/babycool/p/3922738.html 来看看对于一般前台页面发起的get和post请求,我们在Web API中要如何来处理. 这里我使用J ...