centos7以下
[[email protected] mysql]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
[[email protected] mysql]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.21-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> use daochudata
Database changed
MariaDB [daochudata]> create table t(id int);
ERROR 1005 (HY000): Can‘t create table `daochudata`.`t` (errno: 13 "Permission denied")
MariaDB [daochudata]> user cardid
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘user cardid‘ at line 1
MariaDB [daochudata]> use sedata1
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [sedata1]> create table t1(id int);
Query OK, 0 rows affected (0.38 sec)
MariaDB [sedata1]> drop table t1;
Query OK, 0 rows affected (0.08 sec)
MariaDB [sedata1]> create database daochudata;
Query OK, 1 row affected (0.00 sec)
MariaDB [sedata1]> use daochudata
Database changed
MariaDB [daochudata]> create table a(id int);
Query OK, 0 rows affected (0.33 sec)
MariaDB [daochudata]>
-rw-rw----. 1 mysql mysql 33243136 2月 10 16:45 zhilianzhaopin.MAI
-rw-rw----. 1 mysql mysql 6581 2月 7 11:17 zhuoyue.frm
-rw-rw----. 1 mysql mysql 7847936 2月 10 13:38 zhuoyue.MAD
-rw-rw----. 1 mysql mysql 2465792 2月 10 16:45 zhuoyue.MAI
[[email protected] sedata1]# cd ..
[[email protected] Data1]# ll
总用量 76
drwxrwxrwx. 2 mysql mysql 4096 5月 12 15:58 daochudata
drwxrwxrwx. 5 root root 4096 2月 28 11:40 dataprocess
drwxrwxrwx. 2 mysql mysql 32768 5月 12 16:06 sedata1
drwxrwxrwx. 2 mysql mysql 16384 3月 11 08:48 sedata2
drwxrwxrwx. 2 mysql mysql 12288 4月 7 09:07 sedata3
drwxrwxrwx. 2 mysql mysql 4096 2月 4 14:28 sedata4
drwxrwxrwx. 2 mysql mysql 4096 2月 4 14:28 sedata5
[[email protected] Data1]# rm daochudata
rm: 无法删除"daochudata": 是一个目录
[[email protected] Data1]# rm -rf daochudata
[[email protected] Data1]# mv /var/lib/mysql/daochudata .
[[email protected] Data1]# ll
总用量 76
drwx------. 2 mysql mysql 4096 5月 12 16:08 daochudata
drwxrwxrwx. 5 root root 4096 2月 28 11:40 dataprocess
drwxrwxrwx. 2 mysql mysql 32768 5月 12 16:06 sedata1
drwxrwxrwx. 2 mysql mysql 16384 3月 11 08:48 sedata2
drwxrwxrwx. 2 mysql mysql 12288 4月 7 09:07 sedata3
drwxrwxrwx. 2 mysql mysql 4096 2月 4 14:28 sedata4
drwxrwxrwx. 2 mysql mysql 4096 2月 4 14:28 sedata5
[[email protected] Data1]# cd /var/lib/mysql
[[email protected] mysql]# ln -s /media/Data1/daochudata/ daochudata
[[email protected] mysql]# cd daochudata
[[email protected] daochudata]# ll
总用量 104
-rw-rw----. 1 mysql mysql 433 5月 12 16:11 a.frm
-rw-rw----. 1 mysql mysql 98304 5月 12 16:11 a.ibd
-rw-rw----. 1 mysql mysql 65 5月 12 16:08 db.opt
Centos7的软连接
[[email protected] mysql]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 54
Server version: 10.0.28-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| aa |
| datapart10 |
| dumpdata |
| icplatform |
| information_schema |
| jiudian |
| mass |
| mysql |
| performance_schema |
| test |
| txtdata |
| webauth |
| webpass |
+--------------------+
13 rows in set (0.00 sec)
MariaDB [(none)]> create database daochudata;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> show tables;
ERROR 1046 (3D000): No database selected
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| aa |
| daochudata |
| datapart10 |
| dumpdata |
| icplatform |
| information_schema |
| jiudian |
| mass |
| mysql |
| performance_schema |
| test |
| txtdata |
| webauth |
| webpass |
+--------------------+
14 rows in set (0.00 sec)
MariaDB [(none)]> use daochudata;
Database changed
MariaDB [daochudata]> create table t(id int);
Query OK, 0 rows affected (0.56 sec)
MariaDB [daochudata]>