18 MySQL & {RMySQL}

MySQL is a full-featured relational database management system (RDBMS) that competes with the likes of Oracle DB and Microsoft’s SQL Server. MySQL is sponsored by the Swedish company MySQL AB, which is owned by Oracle Corp. However, the MySQL source code is freely available because it was originally developed as freeware. MySQL is written in C and C++ and is compatible with all major operating systems.
MySQL was a free-software database engine originally developed and first released in 1995. MySQL is named after My, the daughter Michael Widenius, of one of the product’s originators. It was originally produced under the GNU General Public License, in which source code is made freely available. MySQL is very popular for Web-hosting applications because of its plethora of Web-optimized features like HTML data types, and because it's available for free. It is part of the Linux, Apache, MySQL, PHP (LAMP) architecture, a combination of platforms that is frequently used to deliver and support advanced Web applications. MySQL runs the back-end databases of some famous websites, including Wikipedia, Google and Facebook- a testament to its stability and robustness despite its decentralized, free-for-all philosophy. MySQL was originally owned by Sun Microsystems; when the company was purchased by Oracle Corp. in 2010, MySQL was part of the package. Although MySQL is technically considered a competitor of Oracle DB, Oracle DB is mainly used by large enterprises, while MySQL is used by smaller, more Web-oriented databases. In addition, MySQL differs from Oracle's product because it's in the public domain.

From: https://www.techopedia.com/definition/3498/mysql

docker pull mysql:8.0.16
docker run --net r-db --name mysql -e MYSQL_ROOT_PASSWORD=coucou -d mysql:8.0.16 \
  --default-authentication-plugin=mysql_native_password \
  && sleep 30 && docker exec -it mysql mysql -uroot -pcoucou -e "create database mydb"

In RStudio

library(DBI)

con <- DBI::dbConnect(
  RMariaDB::MariaDB(), 
  user = "root",
  password = "coucou",
  host = "mysql", 
  db = "mydb"
)


dbListTables(con)
dbWriteTable(con, "mtcars", mtcars)
dbListTables(con)

res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
dbFetch(res)