mysql安装和初始化设置

ubuntu

1)安装:

sudo apt-get install mysql-server

2)启动服务:

sudo service mysql start

3)设置root密码:(第一次使用,因为没有root密码,输入的密码就会成为root密码)

sudo mysql -u root -p

如果出现:

Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.29-0ubuntu0.20.04.3 (Ubuntu)

Copyright (c) 2000, 2022, 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>

恭喜你,完成了。

4)建立用户

CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456';
GRANT ALL ON *.* TO 'dog'@'%';

5)如果需要删除用户

DROP USER 'dog'@'%';

6)退出

quit

 

 

 


欢迎转载,本文地址: https://blog.prodrich.com/detail/51/

带着使命来到世上的你,给他人提供价值,才有价值