mysql数据库存放的路径以及安装路径
mysql数据库存放的路径以及安装路径
1.查看mysql的存放路径
1.查看数据库的存放路径
进⼊mysql终端
mysql>show variables like '%datadir%';
2.查看⽂件安装路径
[root@hadoop01 etc]# whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/share/mysql /usr/share/man/man1/
安装了mysql,但是不知道⽂件都安装在哪些地⽅、放在哪些⽂件夹⾥,可以⽤下⾯的命令查看所有的⽂件路径  whereis
然后我们依次访问上⾯四个⽂件夹和⽂件:
[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  611:54 libmysqlclient_r.so.18 -> libmysqlclient.so.18
lrwxrwxrwx  1 root root      24 Oct  611:54 libmysqlclient_r.so.18.1.0 -> libmysqlclient.so.18.1.0
lrwxrwxrwx  1 root root      24 Oct  611:54 libmysqlclient.so.18 -> libmysqlclient.so.18.1.0
-rwxr-xr-x  1 root root 9581056 Sep 142017 libmysqlclient.so.18.1.0
drwxr-xr-x. 3 root root    4096 Oct  611:54 plugin
[root@hadoop01 mysql]# cd /usr/share/mysql
[root@hadoop01 mysql]# ll
total 1536
drwxr-xr-x  2 root root  4096 Oct  611:54 bulgarian
drwxr-xr-x. 2 root root  4096 Oct  611:54 charsets
drwxr-xr-x. 2 root root  4096 Oct  611:54 czech
drwxr-xr-x. 2 root root  4096 Oct  611:54 danish
-rw-r--r--  1 root root  25575 Sep
drwxr-xr-x. 2 root root  4096 Oct  611:54 dutch
mysql下载之后是个文件夹
drwxr-xr-x. 2 root root  4096 Oct  611:54 english
-
rw-r--r--  1 root root 506007 Sep
drwxr-xr-x. 2 root root  4096 Oct  611:54 estonian
-rw-r--r--  1 root root 795692 Sep 132017 fill_help_tables.sql
drwxr-xr-x. 2 root root  4096 Oct  611:54 french
drwxr-xr-x. 2 root root  4096 Oct  611:54 german
drwxr-xr-x. 2 root root  4096 Oct  611:54 greek
drwxr-xr-x. 2 root root  4096 Oct  611:54 hungarian
-rw-r--r--  1 root root  3963 Sep 132017 innodb_memcached_config.sql
drwxr-xr-x. 2 root root  4096 Oct  611:54 italian
drwxr-xr-x. 2 root root  4096 Oct  611:54 japanese
drwxr-xr-x. 2 root root  4096 Oct  611:54 korean
-
rw-r--r--  1 root root    773 Sep 132017 magic
-rw-r--r--  1 root root  1126 Sep 142017 my-defaultf
-rw-r--r--  1 root root    844 Sep 142017 mysql-log-rotate
-rw-r--r--  1 root root  1695 Sep 132017 mysql_security_commands.sql
-rw-r--r--  1 root root  3548 Sep 132017 mysql_system_tables_data.sql
-rw-r--r--  1 root root  93241 Sep 132017 mysql_system_tables.sql
-rw-r--r--  1 root root  10410 Sep 132017 mysql_test_data_timezone.sql
drwxr-xr-x. 2 root root  4096 Oct  611:54 norwegian
drwxr-xr-x. 2 root root  4096 Oct  611:54 norwegian-ny
drwxr-xr-x. 2 root root  4096 Oct  611:54 polish
drwxr-xr-x. 2 root root  4096 Oct  611:54 portuguese
drwxr-xr-x. 2 root root  4096 Oct  611:54 romanian
drwxr-xr-x. 2 root root  4096 Oct  611:54 russian
drwxr-xr-x  3 root root  4096 Oct  611:54 SELinux
drwxr-xr-x. 2 root root  4096 Oct  611:54 serbian
drwxr-xr-x. 2 root root  4096 Oct  611:54 slovak
drwxr-xr-x. 2 root root  4096 Oct  611:54 spanish
drwxr-xr-x. 2 root root  4096 Oct  611:54 swedish
drwxr-xr-x. 2 root root  4096 Oct  611:54 ukrainian
[root@hadoop01 ~]# cd /usr/share/man/man1/
-bash: cd: /usr/share/man/man1/: Not a directory
3.询运⾏⽂件所在路径(⽂件夹地址)
只要查询⽂件的运⾏⽂件所在地址,直接⽤下⾯的命令
2.Linux下查看mysql是否安装,以及安装路径。
[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
我们单独拿出来讲⼀下:
/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
那么做这些参数怎么来的?他是由/f 配置⽂件控制的/etc/myf
[root@hadoop01 etc]# cat /etc/myf
# For advice on how to change settings please see
# sql/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

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。