SELECT user FROM mysql.user;
Creando un usuario:
CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'password';
Creando un usuario con acceso remoto:
CREATE USER 'jeffrey'@'%' IDENTIFIED BY 'password';
Cambiar la contraseña de un usuario:
ALTER USER 'juan'@'localhost' IDENTIFIED BY 'PASSWORD';
Otra forma:
USE mysql;
UPDATE user SET authentication_string=PASSWORD("mynewpassword") WHERE User='juan';
FLUSH PRIVILEGES;
QUIT
Eliminar usuario:
DROP USER 'nombre_usuario'@'localhost';
Otorgar todos los privilegios a usuario:
GRANT ALL PRIVILEGES ON *.* TO 'juan'@'localhost';
Otorgar todos los privilegios a usuario con grant:
GRANT ALL ON *.* TO 'finley'@'%.example.com' WITH GRANT OPTION;
GRANT ALL ON mydb.mytbl TO 'someuser'@'somehost';
Otorgando solo ciertos privilegios a usuario:
GRANT SELECT, INSERT ON mydb.mytbl TO 'someuser'@'somehost';
Aplicando cambios en tabla de privilegios:
FLUSH PRIVILEGES;
Creando base de datos con character y collate:
CREATE DATABASE testdatabase CHARACTER SET utf8 COLLATE utf8_general_ci;
Creando tabla con character y collate:
CREATE TABLE user (
id INT NOT NULL AUTO_INCREMENT,
username VARCHAR(20) NOT NULL,
pass VARCHAR(50) NOT NULL,
estado INT NOT NULL DEFAULT 1,
PRIMARY KEY (id)
)
CHARACTER SET utf8 COLLATE utf8_general_ci;
Safe Update:
https://solodeuva.blogspot.com/2020/03/mysql-you-are-using-safe-update-mode.html
MySQL Función para convertir en mayúsculas la primera letra
https://solodeuva.blogspot.com/2020/02/mysql-funcion-para-convertir-en.html
Otorgando solo ciertos privilegios a usuario:
GRANT SELECT, INSERT ON mydb.mytbl TO 'someuser'@'somehost';
Aplicando cambios en tabla de privilegios:
FLUSH PRIVILEGES;
Creando base de datos con character y collate:
CREATE DATABASE testdatabase CHARACTER SET utf8 COLLATE utf8_general_ci;
Creando tabla con character y collate:
CREATE TABLE user (
id INT NOT NULL AUTO_INCREMENT,
username VARCHAR(20) NOT NULL,
pass VARCHAR(50) NOT NULL,
estado INT NOT NULL DEFAULT 1,
PRIMARY KEY (id)
)
CHARACTER SET utf8 COLLATE utf8_general_ci;
Safe Update:
https://solodeuva.blogspot.com/2020/03/mysql-you-are-using-safe-update-mode.html
MySQL Función para convertir en mayúsculas la primera letra
https://solodeuva.blogspot.com/2020/02/mysql-funcion-para-convertir-en.html
No hay comentarios:
Publicar un comentario