怎么看mysql是否配置 查看mysql配置

linux中如何查看mysql配置?首先先看看你怎么看mysql是否配置的mysql在哪怎么看mysql是否配置 , 通过which命令
【怎么看mysql是否配置 查看mysql配置】which mysql
显示出目录比如我的是下面这个
/usr/bin/mysql
接下来就可以针对这个目录通过一些命令查看配置文件在哪了,如下
/usr/bin/mysql --verbose --help | grep -A 1 'Default options'
然后在下面会出现一些信息比如我的
Default options are read from the following files in the given order:
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf
这个信息的意思是:
服务器首先读取的是/etc/mysql/my.cnf文件 , 如果前一个文件不存在则继续读/etc/my.cnf文件,如若还不存在便会去读~/.my.cnf文件
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客户端(
如何查看服务器 是否配置mysql右击“电脑”--管理--服务怎么看mysql是否配置 , 搜索mysql怎么看mysql是否配置,如果有就表示成功,
启动服务命令是:net start 服务名,你可以把mysql放到这,如果成功就表示有这个服务 。
linux怎么查看“mysql”配置?linux查看“mysql”配置的步骤和方法如下:
1 在终端下执行 mysql -V
2 在help中查找 mysql --help |grep Distrib
3 在mysql 里查看 select version()
4 在mysql 里查看 status
Centos7查看Mysql配置文件my.cnf 是mysql启动时加载的配置文件,一般会放在mysql的安装目录中 , 用户也可以放在其他目录加载 。
安装mysql后,系统中会有多个 my.cnf 文件,有些是用于测试的 。
安装locate
命令
输出
当我们需要修改配置文件时 , 需要找到mysql启动时是加载了哪个 my.cnf 文件 。
启动mysql后,我们查看mysql的进程,看看是否有设置使用指定目录的 my.cnf 文件,如果有则表示mysql启动时是加载了这个配置文件 。
命令
输出
可以看到 /usr/local/Cellar/mysql/5.6.24/my.cnf 就是mysql启动加载的配置文件 。

推荐阅读