Skip to content
Luke Chen edited this page Dec 26, 2020 · 7 revisions

https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04

sudo mysql_secure_installation

password validation policy: LOW Length >= 8 root/root

sudo mysql -u root -p 
# or
sudo mysql

mysql> CREATE USER 'mysqluser1'@'localhost' IDENTIFIED BY 'testtest1';
ALTER USER 'mysqluser1'@'localhost' IDENTIFIED WITH mysql_native_password BY 'testtest1';

mysql> GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO 'mysqluser1'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

mysql -u mysqluser1 -p
lchen154@ubuntu:~/Downloads$ sudo mysqladmin -p -u mysqluser1 version
Enter password: 
mysqladmin  Ver 8.0.22-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version		8.0.22-0ubuntu0.20.04.3
Protocol version	10
Connection		Localhost via UNIX socket
UNIX socket		/var/run/mysqld/mysqld.sock
Uptime:			25 min 7 sec

Threads: 2  Questions: 35  Slow queries: 0  Opens: 130  Flush tables: 3  Open tables: 51  Queries per second avg: 0.023

Clone this wiki locally