이 블로그 검색

2023년 4월 7일 금요일

MySQL on APM: Basic Usage and Configuration

 Starting MySQL Server

service mysql start

Creating a Database as a MySQL User

Username: root

Database name: test

mysqladmin -u root create test -p

It will ask for a password, but as there is no default password, simply press Enter.

Setting a Password for the Root Account

Account name: root

Password: 1234

use mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1234'

Connecting to the MySQL Server as a User

Username: root

If successful, the prompt will change to mysql>:

mysql -u root -p

Listing Available Databases

show databases;

Selecting a Database to Use

use test;

Creating a Table

Table name: users

create table users (
        id varchar(10) primary key,
        name varchar(20) not null,
        password varchar(10) not null
        );

Listing Available Tables

show tables;

Describing a Table

Check the data type and constraints for each column.

DESC tables;

Retrieving Table Data

Table name: users

select * from users;

Inserting Data into a Table

Table name: users

insert into users (id,name,password) values (0, "name0", "pass0");

Importing a Database

Installing Git

apt-get install git

Cloning a Git Repository

Example database: https://github.com/datacharmer/test_db

git clone <https://github.com/datacharmer/test_db.git>
cd test_db

Importing SQL Files

mysql < employees.sql

Changing the MySQL Port

The default MySQL port is 3306. To change it, modify the port section in the mysqld.cnf file.

vim /etc/mysql/mysql.conf.d/mysqld.cnf

댓글 없음:

댓글 쓰기

Logic Gate Truth Tables & Definitions

Logic Gate Truth Tables Java Code !A // NOT A&B // AND ~(A&B) // NAND A|B // OR ~(A|B) // XOR A^B // XOR ~(A^B) // XNOR ~A // Inve...