Menu
e-lo
  • Home
    • Tech
    • Inspiration and about
  • Database
    • T-SQL
    • SQL Server quick
    • SQL server docs
    • MySql quick sheet
    • Postgre
    • InfluxDB
  • Programming
    • Automating the boring stuff
    • Python 101
    • Python Docs
    • Python Logging
    • Powershell 4 lang ref
    • MS Azure PS
    • MS Azure Command-Line Interface (CLI) doc
  • Azure
    • AZ-104-MS Azure Administrator 101 quick ref
    • AZ-104 Lab
    • MS Windows virtual machines in Azure
    • MS ARM Docs
    • MS ARM Template Docs
    • MS ARM Tutorial
    • MS Deployment scripts (intern/extern)
    • ARM Quickstart
    • MS ARM templates 4h
  • Az Adm
    • AD 101
    • Governance and Compliance 102
    • Administration 103
    • Virtual Networking 104
    • Storage 107 (With table (NoSQL and more))
    • Virtual Machines 108
    • Azure Virtual Machines 101
    • Monitor VM (and market)
  • Linux
    • Top CMD’s
    • Useful CMD Linux
    • ss64 Linux
    • Ubuntu
    • 30 things Ubuntu 18.04
    • Bootable Ubuntu USB
    • LinuxFilesystemTreeOverview
  • Zen
    • Not thinking about anything is Zen
e-lo

MariaDb linux Python ORM

Posted on October 24, 2019October 25, 2019 by espenk

https://linuxize.com/post/how-to-install-mariadb-on-ubuntu-18-04/

MariaDB is an open source, multi-threaded relational database management system, backward compatible replacement for MySQL. It is maintained and developed by the MariaDB Foundation including some of the original developers of the MySQL.

https://linuxize.com/post/how-to-create-a-sudo-user-on-ubuntu/

sudo apt update

sudo apt install mariadb-server

sudo mysql -V

sudo systemctl status mariadb

Run the mysql_secure_installation command to improve the security of the MariaDB installation:

sudo mysql_secure_installation

The script will prompt you to set up the root user password, remove the anonymous user, restrict root user access to the local machine and remove the test database. At the end the script will reload the privilege tables ensuring that all changes take effect immediately.

All steps are explained in detail and it is recommended to answer “Y” (yes) to all questions, except no if you have a sudo password.


Connect to MariaDB from the command line

sudo mysql (cmd access) or mysql -u root -p

DB:

show databases;

To create a MySQL database which uses the utf8 character set:

create database tech character set UTF8 collate utf8_bin

MySQL supports two kinds of UTF8 character sets: utf8 and utf8mb4.

MySQL’s utf8 character table contains characters from the Basic Multililingial Plane, also known as BMP — it is a subset of UTF8 characters which lengths are from 1 to 3 bytes. 4-bytes characters are not included into this character table, and when one attempted to store such characters into a MySQL table, the Incorrect String Value error occurs.

Create a user:

create user ‘espen’ identified by ‘your-password’;

GRANT ALL privileges ON ‘tech‘.* TO ‘espen’@localhost;

flush privileges;

Use tech;

create table test (id int, name varchar(20));

Navigate to env (activate it) run:

pip3 install mysql-connector

ORM:

https://www.sqlalchemy.org/library.html#tutorials

RSS Azure

  • Insights and best practices to run business-critical applications on Azure April 8, 2021

RSS Python

  • PEP 656: Platform Tag for Linux Distributions Using Musl March 17, 2021

Cloud

Ansible (1) ARM (7) azure (23) cmd (1) Django (4) Docker (1) e-lo (2) Flask (2) Github (9) Grafana (2) Information (1) Information Retrieval (12) JAVA (1) kivy (2) Kotlin (4) linux (13) mobile (2) Natural Language Prossesing (NLP) (2) Net.Core (1) Networking and Security (2) OPC (2) PEP8 (1) Philosophy (3) Python (42) Python Networking and Security (2) Reason (2) RMQ (2) Solr (11) Sql (10) VSC (1) Warframe (2) WMVARE (4) Zabbix (7)

Recent Posts

  • TODO Ubuntu Ubuntu 20.04.2 LTS and Bash
  • Disk measurements with typeperf (Pandas py)
  • 2 TODO Azure, Arm and Bash
  • Cryptography with Python – Caesar Cipher
  • 1 TODO Udemy AZ-104 Microsoft Azure Administrator Exam Certification (Scott Duffy)

Archives

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2021 e-lo | Powered by WordPress & Superb Themes