如何查看mysql的数据库存放的路径以及安装路径

网络评论

如何查看mysql的数据库存放的路径以及安装路径

1.简单查看路径

1.查看数据库的存放路径

 

进入mysql终端
mysql>show variables like '%datadir%';

如何查看mysql的数据库存放的路径以及安装路径-图片1

2.查看文件安装路径

[root@hadoop01 etc]# whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz

安装了mysql,但是不知道文件都安装在哪些地方、放在哪些文件夹里,可以用下面的命令查看所有的文件路径  whereis

然后我们依次访问上面四个文件夹和文件:

如何查看mysql的数据库存放的路径以及安装路径-图片2

复制代码
[root@hadoop01 ~]# cd /usr/bin/mysql
-bash: cd: /usr/bin/mysql: Not a directory
[root@hadoop01 ~]# more  /usr/bin/mysql
******** /usr/bin/mysql: Not a text file ********


[root@hadoop01 ~]# cd /usr/lib64/mysql
[root@hadoop01 mysql]# ll
total 9364
lrwxrwxrwx  1 root root      20 Oct  6 11:54 libmysqlclient_r.so.18 -> libmysqlclient.so.18
lrwxrwxrwx  1 root root      24 Oct  6 11:54 libmysqlclient_r.so.18.1.0 -> libmysqlclient.so.18.1.0
lrwxrwxrwx  1 root root      24 Oct  6 11:54 libmysqlclient.so.18 -> libmysqlclient.so.18.1.0
-rwxr-xr-x  1 root root 9581056 Sep 14  2017 libmysqlclient.so.18.1.0
drwxr-xr-x. 3 root root    4096 Oct  6 11:54 plugin


[root@hadoop01 mysql]# cd /usr/share/mysql
[root@hadoop01 mysql]# ll
total 1536
drwxr-xr-x  2 root root   4096 Oct  6 11:54 bulgarian
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 charsets
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 czech
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 danish
-rw-r--r--  1 root root  25575 Sep 13  2017 dictionary.txt
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 dutch
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 english
-rw-r--r--  1 root root 506007 Sep 13  2017 errmsg-utf8.txt
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 estonian
-rw-r--r--  1 root root 795692 Sep 13  2017 fill_help_tables.sql
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 french
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 german
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 greek
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 hungarian
-rw-r--r--  1 root root   3963 Sep 13  2017 innodb_memcached_config.sql
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 italian
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 japanese
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 korean
-rw-r--r--  1 root root    773 Sep 13  2017 magic
-rw-r--r--  1 root root   1126 Sep 14  2017 my-default.cnf
-rw-r--r--  1 root root    844 Sep 14  2017 mysql-log-rotate
-rw-r--r--  1 root root   1695 Sep 13  2017 mysql_security_commands.sql
-rw-r--r--  1 root root   3548 Sep 13  2017 mysql_system_tables_data.sql
-rw-r--r--  1 root root  93241 Sep 13  2017 mysql_system_tables.sql
-rw-r--r--  1 root root  10410 Sep 13  2017 mysql_test_data_timezone.sql
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 norwegian
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 norwegian-ny
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 polish
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 portuguese
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 romanian
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 russian
drwxr-xr-x  3 root root   4096 Oct  6 11:54 SELinux
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 serbian
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 slovak
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 spanish
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 swedish
drwxr-xr-x. 2 root root   4096 Oct  6 11:54 ukrainian

[root@hadoop01 ~]# cd /usr/share/man/man1/mysql.1.gz
-bash: cd: /usr/share/man/man1/mysql.1.gz: Not a directory
复制代码

 

3.询运行文件所在路径(文件夹地址)

只要查询文件的运行文件所在地址,直接用下面的命令

如何查看mysql的数据库存放的路径以及安装路径-图片3

 

 

2.Linux下查看mysql是否安装,以及安装路径。

如何查看mysql的数据库存放的路径以及安装路径-图片4
[root@hadoop01 mysql]#  ps -ef|grep mysql
mysql     1073     1  0 12:51 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
mysql     1336  1073  0 12:51 ?        00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root      1589  1567  0 14:00 tty1     00:00:00 mysql -uroot -px xx
root      1632  1613  0 14:03 pts/0    00:00:00 mysql -uroot -px xx
root      1690  1635  0 14:21 pts/1    00:00:00 grep --color=auto mysql
如何查看mysql的数据库存放的路径以及安装路径-图片4
我们单独拿出来讲一下:

如何查看mysql的数据库存放的路径以及安装路径-图片4
/usr/sbin/mysqld 

--basedir=/usr 
#文件存放目录
--datadir=/var/lib/mysql 
#mysql插件安装地址
--plugin-dir=/usr/lib64/mysql/plugin
#错误日志 
--log-error=/var/log/mysqld.log 
#mysql进程id
--pid-file=/var/run/mysqld/mysqld.pid 
#文件是负责mysql的连接的,如果该文件不存在,则无法访问mysql
--socket=/var/lib/mysql/mysql.sock
如何查看mysql的数据库存放的路径以及安装路径-图片4

那么做这些参数怎么来的?他是由/etc/my.conf 配置文件控制的

复制代码
/etc/my.cnf
[root@hadoop01 etc]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
复制代码

 

 

运营不易,
感谢支持!
weinxin
我的微信
我的微信公众号
我的微信公众号扫一扫
weinxin
我的公众号
 最后更新:2020-10-22
公式库网
  • 本文由 公式库网 发表于 2020年10月13日14:25:59
  • 转载请务必保留本文链接:https://www.gongshiku.com/html/202010/ruhechakanmysqldeshujukucunfangdelujingyijianzhuanglujing.html
网赚风口

抖音小豹子下载,小豹子是什么软件

最近刷抖音经常看到一些主播说打开小豹子,关联剪映,然后能够挣多少多少钱,但视频里主播刻意盖住软件名称,让大家想获取软件关注主播,加群等等。 今天小编要公开这个秘密!首先我这里是有这个软件的,大家...

发表评论