首页 > 编程知识 正文

mysql数据库配置文件在哪(怎么配置数据库文件)

时间:2023-12-07 20:37:48 阅读:313151 作者:PRYF

本文目录一览:

  • 1、linux mysql数据库文件在哪
  • 2、mysql 配置文件在哪
  • 3、MySQL配置文件(my.cnf)路径查看及相关配置

linux mysql数据库文件在哪

FreeBSD主机上的mysql安装的时候数据库文件放在/var/db/mysql下,在Linux主机上的默认存储位置是/var/lib/mysql/下。如果想更换mysql的数据文件的存储位置,则:FreeBSD下:#

/usr/local/etc/rc.d/mysql-server

stop(停止mysql)#

mkdir

/other..

mysql 配置文件在哪

方法/步骤

首先,我们需要找到mysql的安装目录。点击进入。

进入后,我们可以发现如图的文件。

我们找到名为my.ini的文件。

这个文件就是mysql的配置文件。点击进入。

我们可以发现,有些行的前面加有‘#’,而有些没有。

加‘#’的行标识mysql没有启用该行的服务。没有加的标识该服务已经启用。

MySQL配置文件(my.cnf)路径查看及相关配置

查找my.cnf文件路径;

从上可以看出, 服务器首先会读取/etc/my.cnf文件,如果发现该文件不存在,再依次尝试从后面的几个路径进行读取。

参数详解:

[client] #客户端设置,即客户端默认的连接参数

port = 3307 #默认连接端口

socket = /data/mysqldata/3307/mysql.sock #用于本地连接的socket套接字

default-character-set = utf8mb4 #编码

[mysqld] #服务端基本设置

port = 3307 MySQL监听端口

socket = /data/mysqldata/3307/mysql.sock #为MySQL客户端程序和服务器之间的本地通讯指定一个套接字文件

pid-file = /data/mysqldata/3307/mysql.pid#pid文件所在目录

basedir = /usr/local/mysql-5.7.11#使用该目录作为根目录(安装目录)

datadir = /data/mysqldata/3307/data #数据文件存放的目录

tmpdir = /data/mysqldata/3307/tmp #MySQL存放临时文件的目录

character_set_server = utf8mb4 #服务端默认编码(数据库级别)

collation_server = utf8mb4_bin #服务端默认的比对规则,排序规则

user = mysql #MySQL启动用户

log_bin_trust_function_creators = 1 #This variable applies when binary logging is enabled. It controls whether stored function creators can be trusted not to create stored functions that will cause #unsafe events to be written to the binary log. If set to 0 (the default), users are not permitted to create or alter stored functions unless they have the SUPER #privilege in addition to the CREATE ROUTINE or ALTER ROUTINE privilege. 开启了binlog后,必须设置这个值为1.主要是考虑binlog安全

performance_schema = 0 #性能优化的引擎,默认关闭

secure_auth = 1 #secure_auth 为了防止低版本的MySQL客户端(

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。