Rabu, 01 Juli 2020

Perintah Dasar Mysql /UJI


PERINTAH DASAR MYSQL:

status;
select user();
SHOW VARIABLES WHERE Variable_name = 'port';
SHOW VARIABLES WHERE Variable_name = 'hostname';
select user(); 

SELECT system_user();

//PORT "mysql://user:pass@hostname:port/db"
SELECT @@port; //3306 is default

//HOSTNAME DB
SELECT @@hostname;

show variables like "%port%";

mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
Atau
GRANT SELECT ON *.* TO 'username'@'localhost';


CREATE DATABASE dbname;
USE dbname;
CREATE TABLE example ( id smallint unsigned not null auto_increment, name varchar(20) not null, constraint pk_example primary key (id) );

INSERT INTO example ( id, name ) VALUES ( null, 'Sample data' );
DROP TABLE tablename;

Tidak ada komentar:

Posting Komentar