I) connect mysql from Linux OS, create database, create table and retrieve the tables, and show the table structure (CRUD, etc)
[root@iZ2vc5lqzt23aweti4j777Z ~]
total 32
drwxr-xr-x 2 root root 4096 Dec 19 19:52 folder_Dec19th2023
-rw-r
[root@iZ2vc5lqzt23aweti4j777Z ~]
[root@iZ2vc5lqzt23aweti4j777Z ~]
[root@iZ2vc5lqzt23aweti4j777Z ~]
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-12-19 15:55:01 CST; 4h 56min ago
Docs: man:httpd.service(8)
Main PID: 753 (/usr/sbin/httpd)
Status: "Running, listening on: ::706f:5707:ff7f:0 port 80, ..."
Tasks: 213 (limit: 11861)
Memory: 32.8M
CGroup: /system.slice/httpd.service
├─753 /usr/sbin/httpd -DFOREGROUND
├─843 /usr/sbin/httpd -DFOREGROUND
├─846 /usr/sbin/httpd -DFOREGROUND
├─847 /usr/sbin/httpd -DFOREGROUND
└─848 /usr/sbin/httpd -DFOREGROUND
Dec 19 15:55:00 iZ2vc5lqzt23aweti4j777Z systemd[1]: Starting The Apache HTTP Server...
Dec 19 15:55:01 iZ2vc5lqzt23aweti4j777Z httpd[753]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.23.95.44. Set the '>
Dec 19 15:55:01 iZ2vc5lqzt23aweti4j777Z systemd[1]: Started The Apache HTTP Server.
Dec 19 15:55:01 iZ2vc5lqzt23aweti4j777Z httpd[753]: Server configured, listening on: ::706f:5707:ff7f:0 port 80, ...
[root@iZ2vc5lqzt23aweti4j777Z ~]
[root@iZ2vc5lqzt23aweti4j777Z ~]
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-12-19 16:25:42 CST; 4h 27min ago
Docs: man:mysqld(8)
http:
Main PID: 2810 (mysqld)
Tasks: 28 (limit: 11861)
Memory: 371.8M
CGroup: /system.slice/mysqld.service
└─2810 /usr/sbin/mysqld
Dec 19 16:25:35 iZ2vc5lqzt23aweti4j777Z systemd[1]: Starting MySQL Server...
Dec 19 16:25:42 iZ2vc5lqzt23aweti4j777Z systemd[1]: Started MySQL Server.
[root@iZ2vc5lqzt23aweti4j777Z ~]
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.44 MySQL Community Server (GPL)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database pbootcms
-> ;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+
| Database |
+
| information_schema |
| mysql |
| pbootcms |
| performance_schema |
| sys |
+
5 rows in set (0.00 sec)
mysql> use pbootcms;
Database changed
mysql> create table subject(
-> subjet_id int,
-> subject_name varchar(20),
-> subject_hours int
-> )charset = utf8;
Query OK, 0 rows affected (0.01 sec)
mysql> insert into subject
-> (subject_id, subject_name, subject_hours)
-> values
-> (001,"Communication skills", 100);
ERROR 1054 (42S22): Unknown column 'subject_id' in 'field list'
mysql> insert into subject (subjet_id, subject_name, subject_hours) values (001,"Communication skills", 100);
Query OK, 1 row affected (0.00 sec)
mysql> select * from subject;
+
| subjet_id | subject_name | subject_hours |
+
| 1 | Communication skills | 100 |
+
1 row in set (0.00 sec)
mysql> desc subject;
+
| Field | Type | Null | Key | Default | Extra |
+
| subjet_id | int(11) | YES | | NULL | |
| subject_name | varchar(20) | YES | | NULL | |
| subject_hours | int(11) | YES | | NULL | |
+
3 rows in set (0.00 sec)
mysql> show tables;
+
| Tables_in_pbootcms |
+
| subject |
+
1 row in set (0.00 sec)
mysql>