modify-datafile-location-of-mysql

#/etc/my.cnf設定檔 -#

#
# This group is read both both by the client and the server
# use it for options that affect everything
#

[client-server]

#
# include all files from the config directory
#

!includedir /etc/my.cnf.d

# cd /etc/my.cnf.d

#vi mysql-server.cnf

[mysqld]
datadir=/var/lib/mysql  <=== modify this line
#datadir=/mysqldata
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysql/mysqld.log
pid-file=/run/mysqld/mysqld.pid

#mysql資料檔存放位置 group owner都要是mysql 權限755


#service mysqld start

# ps -ef | grep mysql
mysql       4816       1  5 21:05 ?        00:00:01 /usr/libexec/mysqld --basedir=/usr

root        4907    4541  0 21:05 pts/0    00:00:00 grep --color=auto mysql

# mysql -u root -p

Enter password:[enter] 預設無密碼

mysql> show databases;

+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+

4 rows in set (0.00 sec)


# mysql -usqmc


mysql> show databases;

+--------------------+
| Database           |
+--------------------+
| information_schema |
| abc                |
| mysql              |
| sqmc               |
| sqmctest           |
| test               |
| wkh                |
+--------------------+

7 rows in set (0.01 sec)



留言

這個網誌中的熱門文章

10.29 Slow HTTP Denial of Service Attack (Slowloris)

在CentOS 8 Stream安裝NTP Client與設定時區

Update Pattern of TrendMicro AntiVirus Software - ServerProtect