Code Monkey home page Code Monkey logo

server-db's Introduction

MySQL & Python

INSTALL MYSQL-APACHE-PHP

INSTALL APACHE

sudo apt-get update sudo apt-get install apache2 sudo systemctl start apache2

INSTALL MYSQL

sudo apt update sudo apt-cache search mysql-server sudo apt install mysql-server-8.0

CREAD USER (ROOT) AND PASSWORD

sudo mysql ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newPassword'; exit

CONFIG

sudo systemctl start mysql.service sudo mysql_secure_installation sudo systemctl is-enabled mysql.service

INSTALL PHPMYADMIN

sudo apt update sudo apt-get install -y php php-tcpdf php-cgi php-pear php-mbstring libapache2-mod-php php-common php-phpseclib php-mysql sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl sudo phpenmod mbstring sudo systemctl restart apache2

Create database

  1. create database
mysql> CREATE DATABASE prueba;
Query OK, 1 row affected (0.42 sec)
  1. select database
mysql> USE prueba;
Database changed
  1. create table
CREATE TABLE usuario(
    id INT PRIMARY KEY,
    full_name VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL UNIQUE,
    birth_day INT NOT NULL
    );
  1. show table
mysql> show tables;
+------------------+
| Tables_in_prueba |
+------------------+
| usuario          |
+------------------+
1 row in set (0.04 sec)
  1. describe content table
mysql> desc usuario;
+-----------+--------------+------+-----+---------+-------+
| Field     | Type         | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| id        | int          | NO   | PRI | NULL    |       |
| full_name | varchar(255) | NO   |     | NULL    |       |
| email     | varchar(255) | NO   | UNI | NULL    |       |
| birth_day | date         | NO   |     | NULL    |       |
+-----------+--------------+------+-----+---------+-------+
4 rows in set (0.18 sec)
  1. insert data
INSERT INTO usuario(id, full_name, email, birth_day) VALUES ('1', 'Thalia Hernandez', '[email protected]', 23);
INSERT INTO usuario(id, full_name, email, birth_day) VALUES ('2', 'Felipe Calderon y Nojosa', '[email protected]', 48);

6.1 ALTER TABLE

ALTER TABLE usuario MODIFY COLUMN birth_day INT;

ALTER TABLE usuario MODIFY COLUMN id AUTO_INCREMENT;


INSERT INTO user (email, username)
VALUES ('[email protected]', 'Joan'); 

server-db's People

Contributors

erwindevdesign avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.