Skip to content

Instantly share code, notes, and snippets.

@bsed
Last active June 25, 2016 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsed/be86c5dbf502da91a009c151c1b942bd to your computer and use it in GitHub Desktop.
Save bsed/be86c5dbf502da91a009c151c1b942bd to your computer and use it in GitHub Desktop.
# one shell
```bash
sudo mysqld_safe --skip-grant-tables &
```
# two shell
```bash
kelvin@gnux:~> sudo mysql -u root (06/25 20:51:01)
[sudo] password for kelvin:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 41
Server version: 10.0.25-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select user,plugin from user;
+------+-------------+
| user | plugin |
+------+-------------+
| root | unix_socket |
+------+-------------+
1 row in set (0.00 sec)
MariaDB [mysql]> UPDATE user SET plugin="";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [mysql]> UPDATE user SET password=PASSWORD("password") WHERE user="root";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]>
```
## end
```bash
MariaDB [mysql]> quit
Bye
kelvin@gnux:~> mysql -u root -p (06/25 20:57:27)
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 42
Server version: 10.0.25-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment