· 9 years ago · Feb 22, 2017, 02:34 AM
1[kaleb@localhost ~]$ mysql -u root -p
2Enter password:
3Welcome to the MariaDB monitor. Commands end with ; or \g.
4Your MariaDB connection id is 6
5Server version: 5.5.52-MariaDB MariaDB Server
6
7Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
8
9Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
10
11MariaDB [(none)]> \h
12
13General information about MariaDB can be found at
14http://mariadb.org
15
16List of all MySQL commands:
17Note that all text commands must be first on line and end with ';'
18? (\?) Synonym for `help'.
19clear (\c) Clear the current input statement.
20connect (\r) Reconnect to the server. Optional arguments are db and host.
21delimiter (\d) Set statement delimiter.
22edit (\e) Edit command with $EDITOR.
23ego (\G) Send command to mysql server, display result vertically.
24exit (\q) Exit mysql. Same as quit.
25go (\g) Send command to mysql server.
26help (\h) Display this help.
27nopager (\n) Disable pager, print to stdout.
28notee (\t) Don't write into outfile.
29pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
30print (\p) Print current command.
31prompt (\R) Change your mysql prompt.
32quit (\q) Quit mysql.
33rehash (\#) Rebuild completion hash.
34source (\.) Execute an SQL script file. Takes a file name as an argument.
35status (\s) Get status information from the server.
36system (\!) Execute a system shell command.
37tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
38use (\u) Use another database. Takes database name as argument.
39charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
40warnings (\W) Show warnings after every statement.
41nowarning (\w) Don't show warnings after every statement.
42
43For server side help, type 'help contents'
44
45MariaDB [(none)]> create database testdb-itn170;
46ERROR 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 '-itn170' at line 1
47MariaDB [(none)]> CREATE DATABASE testdb-itn170;
48ERROR 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 '-itn170' at line 1
49MariaDB [(none)]> create database testdbitn170;
50Query OK, 1 row affected (0.01 sec)
51
52MariaDB [(none)]> create user 'testuser-itn170'@'localhost' identified by 'password';
53Query OK, 0 rows affected (0.12 sec)
54
55MariaDB [(none)]> grant all on testdbitn170.* to 'testuser-itn170' identified by 'password';
56Query OK, 0 rows affected (0.03 sec)
57
58MariaDB [(none)]> exit
59Bye
60[kaleb@localhost ~]$ mysql -u testuser-itn170 -p
61Enter password:
62ERROR 1045 (28000): Access denied for user 'testuser-itn170'@'localhost' (using password: YES)
63[kaleb@localhost ~]$
64[kaleb@localhost ~]$ mysql -u testuser-itn170 -p
65Enter password:
66Welcome to the MariaDB monitor. Commands end with ; or \g.
67Your MariaDB connection id is 8
68Server version: 5.5.52-MariaDB MariaDB Server
69
70Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
71
72Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
73
74MariaDB [(none)]> use testdbitn170;
75Database changed
76MariaDB [testdbitn170]> create table students (student_id INT NOT NULL AUTO_INCREMENT PRIMAL KEY, first_name TEXT, last_name TEXT);
77ERROR 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 'KEY, first_name TEXT, last_name TEXT)' at line 1
78MariaDB [testdbitn170]> create table students (student_id INT PRIMAL KEY, first_name TEXT, last_name TEXT);
79ERROR 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 'KEY, first_name TEXT, last_name TEXT)' at line 1
80MariaDB [testdbitn170]> create table students (student_id, first_name TEXT, last_name TEXT);
81ERROR 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 ' first_name TEXT, last_name TEXT)' at line 1
82MariaDB [testdbitn170]> create table students (course_id INT, first_name VARCHAR(40), LAST_NAME varchar (40))
83 -> ;
84Query OK, 0 rows affected (0.24 sec)
85
86MariaDB [testdbitn170]> EXIT
87Bye
88[kaleb@localhost ~]$ sudo systemctl stop mysqld
89[sudo] password for kaleb:
90Failed to stop mysqld.service: Unit mysqld.service not loaded.
91[kaleb@localhost ~]$ sudo msqld_safe --skip-grant-tables &
92[1] 25142
93sudo: msqld_safe: command not found
94[1]+ Exit 1 sudo msqld_safe --skip-grant-tables
95[kaleb@localhost ~]$ sudo systemctl stop mysql
96Failed to stop mysql.service: Unit mysql.service not loaded.
97[kaleb@localhost ~]$ sudo msql_safe --skip-grant-tables &
98[1] 25216
99sudo: msql_safe: command not found
100[1]+ Exit 1 sudo msql_safe --skip-grant-tables
101[kaleb@localhost ~]$ sudo mysqld_safe --skip-grant-tables &
102[1] 25234
103[kaleb@localhost ~]$ 170221 20:58:35 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
104170221 20:58:35 mysqld_safe A mysqld process already exists
105^C
106[1]+ Exit 1 sudo mysqld_safe --skip-grant-tables
107[kaleb@localhost ~]$ mysql -r root
108ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'root'
109[kaleb@localhost ~]$ su -
110Password:
111Last login: Tue Feb 14 21:28:42 EST 2017 on pts/0
112[root@localhost ~]# mysql -r root
113ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
114[root@localhost ~]# systemctl stop mysqld
115Failed to stop mysqld.service: Unit mysqld.service not loaded.
116[root@localhost ~]# mysqld_safe --skip-grant-tables &
117[1] 25650
118[root@localhost ~]# 170221 21:01:04 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
119170221 21:01:04 mysqld_safe A mysqld process already exists
120mysqld_safe --skip-g
121[1]+ Exit 1 mysqld_safe --skip-grant-tables
122[root@localhost ~]# mysqld_safe --skip-grant-tables &
123[1] 25807
124[root@localhost ~]# 170221 21:01:29 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
125170221 21:01:30 mysqld_safe A mysqld process already exists
126mysql -r root
127ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
128[1]+ Exit 1 mysqld_safe --skip-grant-tables
129[root@localhost ~]# mysql -r root -p
130Enter password:
131ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
132[root@localhost ~]# mysql -r root -p
133Enter password:
134ERROR 1049 (42000): Unknown database 'root'
135[root@localhost ~]# mysql -r root -p
136Enter password:
137ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
138[root@localhost ~]# mysql -r root -p
139Enter password:
140ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
141[root@localhost ~]# mysql -u root -p
142Enter password:
143ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
144[root@localhost ~]# mysql -u root -p
145Enter password:
146ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
147[root@localhost ~]# mysql -u root -p
148Enter password:
149Welcome to the MariaDB monitor. Commands end with ; or \g.
150Your MariaDB connection id is 18
151Server version: 5.5.52-MariaDB MariaDB Server
152
153Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
154
155Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
156
157MariaDB [(none)]> use myql;
158ERROR 1049 (42000): Unknown database 'myql'
159MariaDB [(none)]> use mysql;
160Reading table information for completion of table and column names
161You can turn off this feature to get a quicker startup with -A
162
163Database changed
164MariaDB [mysql]> update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
165Query OK, 4 rows affected (0.03 sec)
166Rows matched: 4 Changed: 4 Warnings: 0
167
168MariaDB [mysql]> flush privileges;
169Query OK, 0 rows affected (0.00 sec)
170
171MariaDB [mysql]> exit
172Bye
173[root@localhost ~]# systemctl start mysqld
174Failed to start mysqld.service: Unit not found.
175[root@localhost ~]# systemctl start mysql
176Failed to start mysql.service: Unit not found.
177[root@localhost ~]# systemctl start mysqld
178Failed to start mysqld.service: Unit not found.
179[root@localhost ~]# systemctl start mysql
180Failed to start mysql.service: Unit not found.
181[root@localhost ~]# systemctl start mariadbservice
182Failed to start mariadbservice.service: Unit not found.
183[root@localhost ~]# status mariadb_service
184bash: status: command not found...
185[root@localhost ~]# systemctl status mariadb_service
186Unit mariadb_service.service could not be found.
187[root@localhost ~]# systemctl status mariadb.service
188â— mariadb.service - MariaDB database server
189 Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
190 Active: active (running) since Tue 2017-02-21 18:31:23 EST; 2h 43min ago
191 Process: 1263 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
192 Process: 1034 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
193 Main PID: 1261 (mysqld_safe)
194 CGroup: /system.slice/mariadb.service
195 ├─1261 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
196 └─1903 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql...
197
198Feb 21 18:35:49 localhost.localdomain systemd[1]: Starting MariaDB database s...
199Feb 21 18:31:17 localhost.localdomain mysqld_safe[1261]: 170221 18:31:17 mysq...
200Feb 21 18:31:17 localhost.localdomain mysqld_safe[1261]: 170221 18:31:17 mysq...
201Feb 21 18:31:23 localhost.localdomain systemd[1]: Started MariaDB database se...
202Hint: Some lines were ellipsized, use -l to show in full.
203[root@localhost ~]# systemctl restart mariadb.service
204[root@localhost ~]# systemctl status mariadb.service
205â— mariadb.service - MariaDB database server
206 Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
207 Active: active (running) since Tue 2017-02-21 21:14:39 EST; 4s ago
208 Process: 27015 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
209 Process: 26987 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
210 Main PID: 27014 (mysqld_safe)
211 CGroup: /system.slice/mariadb.service
212 ├─27014 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
213 └─27172 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysq...
214
215Feb 21 21:14:36 localhost.localdomain systemd[1]: Starting MariaDB database s...
216Feb 21 21:14:37 localhost.localdomain mysqld_safe[27014]: 170221 21:14:37 mys...
217Feb 21 21:14:37 localhost.localdomain mysqld_safe[27014]: 170221 21:14:37 mys...
218Feb 21 21:14:39 localhost.localdomain systemd[1]: Started MariaDB database se...
219Hint: Some lines were ellipsized, use -l to show in full.
220[root@localhost ~]# mysql -u root -p
221Enter password:
222ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
223[root@localhost ~]# password
224bash: password: command not found...
225[root@localhost ~]# mysql -u root -p
226Enter password:
227Welcome to the MariaDB monitor. Commands end with ; or \g.
228Your MariaDB connection id is 3
229Server version: 5.5.52-MariaDB MariaDB Server
230
231Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
232
233Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
234
235MariaDB [(none)]> CREATE DATABASE database course;
236ERROR 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 'database course' at line 1
237MariaDB [(none)]> CREATE DATABASE course;
238Query OK, 1 row affected (0.00 sec)
239
240MariaDB [(none)]> use database course;
241ERROR 1049 (42000): Unknown database 'database'
242MariaDB [(none)]> use course;
243Database changed
244MariaDB [course]> create tabe courses(course_id varchar (2),course_name varchar (40),campus_id decimal(10,0));
245ERROR 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 'tabe courses(course_id varchar (2),course_name varchar (40),campus_id decimal(10' at line 1
246MariaDB [course]> create table courses(course_id varchar (2),course_name varchar (40),campus_id decimal(10,0));
247Query OK, 0 rows affected (0.18 sec)
248
249MariaDB [course]> create table if not exists courses_mirror
250 -> ;
251ERROR 1113 (42000): A table must have at least 1 column
252MariaDB [course]> create table if not exists courses mirror;
253ERROR 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 '' at line 1
254MariaDB [course]> insert into courses (course_id,course_name)
255 -> values ('1','ITN170 RelationalDatabase');
256Query OK, 1 row affected (0.05 sec)
257
258MariaDB [course]> values ('3','ITN170 Linux');
259ERROR 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 'values ('3','ITN170 Linux')' at line 1
260MariaDB [course]> insert into courses (course_id,course_name) values ('3','ITN170 Linux');
261Query OK, 1 row affected (0.01 sec)
262
263MariaDB [course]> insert into courses (course_id,course_name) values ('2','ITN180_Unix');
264Query OK, 1 row affected (0.07 sec)
265
266MariaDB [course]> insert into courses (course_id,course_name) values ('4','ITN170_Network');
267Query OK, 1 row affected (0.02 sec)
268
269MariaDB [course]> insert into courses (course_id,course_name) values ('5','ITN170_System');
270Query OK, 1 row affected (0.03 sec)
271
272MariaDB [course]> select * from courses
273 -> ;
274+-----------+---------------------------+-----------+
275| course_id | course_name | campus_id |
276+-----------+---------------------------+-----------+
277| 1 | ITN170 RelationalDatabase | NULL |
278| 3 | ITN170 Linux | NULL |
279| 2 | ITN180_Unix | NULL |
280| 4 | ITN170_Network | NULL |
281| 5 | ITN170_System | NULL |
282+-----------+---------------------------+-----------+
2835 rows in set (0.00 sec)
284
285MariaDB [course]> select course_id from courses;
286+-----------+
287| course_id |
288+-----------+
289| 1 |
290| 3 |
291| 2 |
292| 4 |
293| 5 |
294+-----------+
2955 rows in set (0.00 sec)
296
297MariaDB [course]> from courses group by course_id
298 -> ;
299ERROR 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 'from courses group by course_id' at line 1
300MariaDB [course]> from courses group by course_id;
301ERROR 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 'from courses group by course_id' at line 1
302MariaDB [course]> select from courses group by course_id
303 -> ;
304ERROR 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 'from courses group by course_id' at line 1
305MariaDB [course]> select course_id from courses group by course_id;
306+-----------+
307| course_id |
308+-----------+
309| 1 |
310| 2 |
311| 3 |
312| 4 |
313| 5 |
314+-----------+
3155 rows in set (0.03 sec)
316
317MariaDB [course]>