|
1. DDL : CREATE TABLE
1.1
- MariaDB [inventory]> create table product ( id int(11) primary key auto_increment ,
- -> name varchar(100) not null,
- -> price double not null,
- -> stock int(11),
- -> id_category int(11),
- -> id_manufacturer int(11) ) ;
- Query OK, 0 rows affected (0.018 sec)
- MariaDB [inventory]>
复制代码- MariaDB [inventory]> alter table product add constraint check ( id_category is not null ) ;
- Query OK, 1 row affected (0.043 sec)
- Records: 1 Duplicates: 0 Warnings: 0
复制代码- MariaDB [inventory]> alter table product modify stock int(11) not null;
- Query OK, 0 rows affected (0.246 sec)
- Records: 0 Duplicates: 0 Warnings: 0
复制代码
2. DML (CRUD)
2.1
- MariaDB [inventory]> insert into product (name, price, stock, id_category, id_manufacturer) values
- -> ('SDSSDP-128G-G25 2.5', 82.04 , 30 , 3,1);
- Query OK, 1 row affected (0.003 sec)
复制代码- MariaDB [inventory]> update product set price=92.04, stock=31 where id=1;
- Query OK, 1 row affected (0.004 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
复制代码- MariaDB [inventory]> insert into product (name, price, stock, id_category, id_manufacturer) values ('CPU A', 1000.04 , 30 , 3,10);
- Query OK, 1 row affected (0.003 sec)
- MariaDB [inventory]> select * from product;
- +----+---------------------+---------+-------+-------------+-----------------+
- | id | name | price | stock | id_category | id_manufacturer |
- +----+---------------------+---------+-------+-------------+-----------------+
- | 1 | SDSSDP-128G-G25 2.5 | 92.04 | 31 | 3 | 1 |
- | 2 | CPU A | 1000.04 | 30 | 3 | 10 |
- +----+---------------------+---------+-------+-------------+-----------------+
- 2 rows in set (0.001 sec)
- MariaDB [inventory]> delete from product where id=2;
- Query OK, 1 row affected (0.004 sec)
- MariaDB [inventory]> select * from product;
- +----+---------------------+-------+-------+-------------+-----------------+
- | id | name | price | stock | id_category | id_manufacturer |
- +----+---------------------+-------+-------+-------------+-----------------+
- | 1 | SDSSDP-128G-G25 2.5 | 92.04 | 31 | 3 | 1 |
- +----+---------------------+-------+-------+-------------+-----------------+
- 1 row in set (0.001 sec)
- MariaDB [inventory]>
复制代码 3. DCL :GRANT:
- MariaDB [inventory]> grant select on inventory.* to mobius@'%';
- Query OK, 0 rows affected (0.001 sec)
复制代码
4. Apache:
- <VirtualHost *:80>
- ServerAdmin root@server4.example.com
- DocumentRoot "/var/www/html"
- <Directory "/var/www/html">
- Options Indexes FollowSymLinks
- AllowOverride None
- Require all granted
- </Directory>
- ServerName server4.example.com
- ErrorLog "/var/log/httpd/server4.example.com-error.log"
- CustomLog "/var/log/httpd/server4.example.com-access.log" common
- </VirtualHost>
- <VirtualHost *:80>
- ServerAdmin root@www4.example.com
- DocumentRoot "/var/www/virtual"
- <Directory "/var/www/virtual">
- Options FollowSymLinks
- AllowOverride None
- Require all granted
- </Directory>
- ServerName www4.example.com
- ErrorLog "/var/log/httpd/www4.example.com-error.log"
- CustomLog "/var/log/httpd/www4.example.com-access.log" common
- </VirtualHost>
复制代码
SSL.conf的完整:
- #
- # When we also provide SSL we have to listen to the
- # standard HTTPS port in addition.
- #
- Listen 443 https
- ##
- ## SSL Global Context
- ##
- ## All SSL configuration in this context applies both to
- ## the main server and all SSL-enabled virtual hosts.
- ##
- # Pass Phrase Dialog:
- # Configure the pass phrase gathering process.
- # The filtering dialog program (`builtin' is a internal
- # terminal dialog) has to provide the pass phrase on stdout.
- SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
- # Inter-Process Session Cache:
- # Configure the SSL Session Cache: First the mechanism
- # to use and second the expiring timeout (in seconds).
- SSLSessionCache shmcb:/run/httpd/sslcache(512000)
- SSLSessionCacheTimeout 300
- #
- # Use "SSLCryptoDevice" to enable any supported hardware
- # accelerators. Use "openssl engine -v" to list supported
- # engine names. NOTE: If you enable an accelerator and the
- # server does not start, consult the error logs and ensure
- # your accelerator is functioning properly.
- #
- SSLCryptoDevice builtin
- #SSLCryptoDevice ubsec
- ##
- ## SSL Virtual Host Context
- ##
- <VirtualHost _default_:443>
- ServerAdmin root@server4.example.com
- WSGIScriptAlias / /var/www/html/special.wsgi
- ServerName server4.example.com
- ErrorLog "/var/log/httpd/https_server4.example.com-error.log"
- CustomLog "/var/log/httpd/https_server4.example.com-access.log" common
- SSLEngine on
- SSLProtocol all -SSLv3
- SSLHonorCipherOrder on
- SSLCipherSuite PROFILE=SYSTEM
- SSLProxyCipherSuite PROFILE=SYSTEM
- SSLCertificateFile /etc/pki/tls/certs/server4.crt
- SSLCertificateKeyFile /etc/pki/tls/private/server4.key
- SSLCACertificateFile /etc/pki/tls/certs/example-ca.crt
- </VirtualHost>
- <VirtualHost _default_:443>
- ServerAdmin root@www4.example.com
- DocumentRoot "/var/www/virtual"
- ScriptAlias /cgi-bin/ '/var/www/cgi-bin/'
- <Directory "/var/www/virtual">
- Options Indexes FollowSymLinks
- AllowOverride None
- Require all granted
- </Directory>
- <Directory "/var/www/virtual/money">
- Options Indexes FollowSymLinks
- AllowOverride None
- Require all denied
- Require local
- </Directory>
-
- ServerName www4.example.com
- ErrorLog "/var/log/httpd/https_www4.example.com-error.log"
- CustomLog "/var/log/httpd/https_www4.example.com-access.log" common
- SSLEngine on
- SSLProtocol all -SSLv3
- SSLHonorCipherOrder on
- SSLCipherSuite PROFILE=SYSTEM
- SSLProxyCipherSuite PROFILE=SYSTEM
- SSLCertificateFile /etc/pki/tls/certs/server4.crt
- SSLCertificateKeyFile /etc/pki/tls/private/server4.key
- SSLCACertificateFile /etc/pki/tls/certs/example-ca.crt
- </VirtualHost>
复制代码
|
|