반응형

desktop# yum groupinstall mariadb-client -y

server# yum groupinstall mariadb -y

server# systemctl start mariadb.service

server# systemctl enable mariadb.service

ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'


server# firewall-cmd --permanent --add-service=mysql
server# firewall-cmd --reload


server# mysql -uroot

MariaDB [(none)]> CREATE DATABASE legacy;

MariaDB [(none)]> exit


server# mysql -u root legacy < /home/student/mariadb.dump


server# mysql -u root

MariaDB [(none)]> CREATE USER mary@'%' IDENTIFIED BY 'mary_password';

Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> CREATE USER lagacy@'%' IDENTIFIED BY 'lagacy_password';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> CREATE USER report@'%' IDENTIFIED BY 'report_password';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT SELECT ON legacy.* TO mary@'%';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT SELECT,INSERT,UPDATE,DELETE ON legacy.* TO legacy@'%';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT SELECT ON legacy.* TO report@'%';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)



server# mysql -u root


MariaDB [(none)]> USE legacy;
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 [legacy]> DESCRIBE manufacturer;
+--------------+--------------+------+-----+---------+----------------+
| Field        | Type         | Null | Key | Default | Extra          |
+--------------+--------------+------+-----+---------+----------------+
| id           | int(11)      | NO   | PRI | NULL    | auto_increment |
| name         | varchar(100) | NO   |     | NULL    |                |
| seller       | varchar(100) | YES  |     | NULL    |                |
| phone_number | varchar(17)  | YES  |     | NULL    |                |
+--------------+--------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)


MariaDB [legacy]> INSERT INTO manufacturer(name,seller,phone_number) values ('HP','JoeDoe','+1 (432) 754-3509');
Query OK, 1 row affected (0.02 sec)

MariaDB [legacy]> INSERT INTO manufacturer(name,seller,phone_number) values ('DELL','LukeSkywalker','+1 (431) 219-4589');
MariaDB [legacy]> INSERT INTO manufacturer(name,seller,phone_number) values ('Lenovo','DarthVader','+1 (327) 647-6787');


반응형

'Linux > CentOS' 카테고리의 다른 글

[CentOS7] Apache TLS  (0) 2015.03.18
[CentOS7] Apache HTTP  (0) 2015.03.18
[CentOS7] MariaDB - 3  (0) 2015.03.18
[CentOS7] MariaDB - 2  (0) 2015.03.18
[CentOS7] MariaDB - 1  (0) 2015.03.18
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기