paint-brush
I Made ChatGPT Act as a MariaDB Databaseby@alejandroduarte
1,548 reads
1,548 reads

I Made ChatGPT Act as a MariaDB Database

by Alejandro DuarteJanuary 12th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

ChatGPT can be used to write code and improve databases. It can also act as a command line tool. It responds with the output of commands. For example, you can make it act as a MariaDB database.
featured image - I Made ChatGPT Act as a MariaDB Database
Alejandro Duarte HackerNoon profile picture

ChatGPT is truly impressive. You can instruct it to do all sorts of things when they can be communicated in plain text. Software developers are already using it to write code or improve SQL queries, among many other things.


But ChatGPT can also act as software. For example, if you tell it the following:


Act as the MariaDB command line tool. Only reply to commands with output in one single code block. Do not write any explanations. Expect English messages in {curly brackets}. My first command is SELECT VERSION();


Then you'll get this answer:


Isn't that impressive? There. Now you have a new way to get started with MariaDB without installing anything. I mean, that was even faster than using Docker on your browser!


Let's show the available databases (or schemas):


SHOW DATABASES;

Can we create a new database?


CREATE DATABASE test;

Yes, we can! How about creating a new table and inserting data?


CREATE TABLE test.messages(content TEXT);
INSERT INTO test.messages VALUES("Hi MariaDB 👋");

Query OK, 1 row affected. It seems to be working! Let's double-check that the data is stored:


SELECT * FROM test.messages;

Hi MariaDB 👋! This is so cool! Open a new tab in your browser, and try it out to see it in action.

When you want to stop ChatGPT from acting like a MariaDB database, just tell it to do so:


{stop acting like mariadb}


Or simply:


{stop}