“Ubuntu 20 server安装Mysql”的版本间的差异
跳到导航
跳到搜索
(建立内容为“category:Mysql ==安装环境== Ubuntu 20.04.4 LTS ==安装过程== 安装服务端 sudo apt-get install mysql-server 安装客户端 sudo apt install my…”的新页面) |
小 (→登录) |
||
(未显示同一用户的1个中间版本) | |||
第38行: | 第38行: | ||
==登录测试== | ==登录测试== | ||
+ | 第一登录使用root,如果使用非root登录会提示访问拒绝 | ||
+ | sudo mysql -u root | ||
+ | |||
+ | 查看用户,查看mysql数据库的use表 | ||
+ | select user,host,plugin from user; | ||
+ | +------------------+-----------+-----------------------+ | ||
+ | | user | host | plugin | | ||
+ | +------------------+-----------+-----------------------+ | ||
+ | | procedure | % | caching_sha2_password | | ||
+ | | debian-sys-maint | localhost | caching_sha2_password | | ||
+ | | mysql.infoschema | localhost | caching_sha2_password | | ||
+ | | mysql.session | localhost | caching_sha2_password | | ||
+ | | mysql.sys | localhost | caching_sha2_password | | ||
+ | | root | localhost | auth_socket | | ||
+ | +------------------+-----------+-----------------------+ | ||
+ | 6 rows in set (0.00 sec) | ||
+ | |||
+ | 设置登录密码 | ||
+ | mysqladmin -uroot -p password |
2022年11月18日 (五) 08:33的最新版本
安装环境
Ubuntu 20.04.4 LTS
安装过程
安装服务端
sudo apt-get install mysql-server
安装客户端
sudo apt install mysql-client
检查安装结果
查看版本
mysql --version mysql Ver 8.0.29-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
查看启动情况
sudo service mysql status [sudo] password for pwh: mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2022-11-18 04:36:11 UTC; 3h 21min ago Main PID: 995 (mysqld) Status: "Server is operational" Tasks: 38 (limit: 9406) Memory: 425.9M CGroup: /system.slice/mysql.service └─995 /usr/sbin/mysqld
查看端口使用情况
sudo netstat -tap | grep mysql tcp 0 0 localhost:33060 0.0.0.0:* LISTEN 995/mysqld tcp6 0 0 [::]:mysql [::]:* LISTEN 995/mysqld
登录测试
第一登录使用root,如果使用非root登录会提示访问拒绝
sudo mysql -u root
查看用户,查看mysql数据库的use表
select user,host,plugin from user; +------------------+-----------+-----------------------+ | user | host | plugin | +------------------+-----------+-----------------------+ | procedure | % | caching_sha2_password | | debian-sys-maint | localhost | caching_sha2_password | | mysql.infoschema | localhost | caching_sha2_password | | mysql.session | localhost | caching_sha2_password | | mysql.sys | localhost | caching_sha2_password | | root | localhost | auth_socket | +------------------+-----------+-----------------------+ 6 rows in set (0.00 sec)
设置登录密码
mysqladmin -uroot -p password