To connect to MariaDB on Debian 12 and create a table, you can follow these steps:
- Install MariaDB:
sudo apt update sudo apt install mariadb-server - Start the MariaDB service:
sudo systemctl start mariadb - Secure the MariaDB installation:
sudo mysql_secure_installationThis command will prompt you to set a root password and perform other security-related configurations.
- Connect to the MariaDB server:
sudo mysql -u root -pEnter the root password you set during the secure installation.
- Create a new database:
CREATE DATABASE your_database_name;Replace
your_database_namewith the desired name for your database. - Use the newly created database:
USE your_database_name; - Create a table:
CREATE TABLE your_table_name ( column1 datatype constraint, column2 datatype constraint, ... );Replace
your_table_namewith the desired name for your table. Specify the columns and their datatypes as needed. - Insert data into the table:
INSERT INTO your_table_name (column1, column2, ...) VALUES (value1, value2, ...);Replace
your_table_namewith the name of your table. Specify the values to be inserted into the respective columns.
That’s it! You have now connected to MariaDB on Debian 12 and created a table.