赞
踩
sudo apt update
sudo apt install mysql-server
mysql --version
出现类似这样的代表正确安装
Server version: 8.0.33-0ubuntu0.20.04.2 (Ubuntu)
使用如下两个命令可启动mysql
sudo service mysql start
sudo systemctl start mysql
可能会让输入密码,输入即可
使用如下两个命令可检查服务状态
sudo service mysql status
sudo systemctl status mysql
出现如下代表正确启动
Jul 28 05:32:12 ubuntu systemd[1]: Starting MySQL Community Server...
Jul 28 05:32:15 ubuntu systemd[1]: Started MySQL Community Server.
否则重复3
sudo mysql
出现如下为正确启动
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.33-0ubuntu0.20.04.2 (Ubuntu)
Copyright (c) 2000, 2023, 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>
SHOW DATABASES;
CREATE DATABASE mydb1;
默认字符集的方式创建了mydb1的数据库
USE mydb1;
使用mydb1这个数据库
SHOW TABLES;
quit;
用其中一个
sudo service mysql stop
sudo systemctl stop mysql
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。