0
点赞
收藏
分享

微信扫一扫

Start and Stop mysql in Linux, and create database, user in Mysql database

How to change the root’s password in MySQL

root@SecondaryDataUse:~/nocodb/docker-compose/mysql# pwd

/root/nocodb/docker-compose/mysql

root@SecondaryDataUse:~/nocodb/docker-compose/mysql# sudo mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 46

Server version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'my_root_password';

Query OK, 0 rows affected (0.06 sec)

mysql>

How to stop/start the mysql service on Linux Ubuntu20.04

 

How to login the mysql with user and password from Linux terminal:

Create Mysql database, user, and grant user to database.

mysql> create database root_db;
Query OK, 1 row affected (0.02 sec)

mysql> show databases;

mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password.check_user_name    | ON     |
| validate_password.dictionary_file    |        |
| validate_password.length             | 8      |
| validate_password.mixed_case_count   | 1      |
| validate_password.number_count       | 1      |
| validate_password.policy             | MEDIUM |
| validate_password.special_char_count | 1      |
+--------------------------------------+--------+
7 rows in set (0.01 sec)

mysql> SET GLOBAL validate_password.length = 4;
Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL validate_password.policy=LOW;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER 'noco'@'localhost' IDENTIFIED BY 'enjoypassword';
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL PRIVILEGES ON root_db.* TO 'noco'@'localhost';
Query OK, 0 rows affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| root_db            |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

 

From: 

What's NocoDB, NocoDB is an open source platform that turns any database into a smart spreadsheet - #5 by bigdata - Nocodb - Big Data Small Team

举报

相关推荐

0 条评论