DBA Hub

📋Steps in this guide1/1

How to connect to mysql db

hostname$ export PATH=/usr/local/mysql/bin:$PATH hostname$ which mysql /usr/local/mysql/bin

mysql configurationintermediate
by MYSQL
13 views
1

How to connect to mysql db

Find current connection info: Below is the alternative command: Get current user and current database: switch to another database:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
hostname$
export PATH=/usr/local/mysql/bin:$PATH
hostname$
which mysql
/usr/local/mysql/bin
SYNTAX - mysql -u user -p
C:\Program Files\MariaDB 10.4\bin>
mysql -u root -p
Enter password: ****
Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 19.Server version: 10.4.18-MariaDB
MariaDB [(none)]>
\s
--------------
mysql Ver 15.1 Distrib 10.4.18-MariaDB, for Win64 (AMD64), source revision 53123dfa3e365138591fd2f160c6057aca00a3e6
Connection id: 19
Current database:
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server: MariaDB
Server version: 10.4.18-MariaDB mariadb.org binary distribution
........
MariaDB [(none)]>
status;
mariadb> select current_user,database();
+----------------+------------+
| current_user  | database() |
+----------------+------------+
| root@localhost | test |
+----------------+------------+
1 row in set (0.00 sec)
MariaDB>
USE TEST;
Database changed
MariaDB>
select database();
+------------+
| database() |
+------------+
| test |
+------------+
1 row in set (0.00 sec)

Comments (0)

Please to add comments

No comments yet. Be the first to comment!