← Back to list

ubuntu 安装mysql

Published on: | Views: 87

ubuntu安装mysql非常简单,主要安装后要自己找下密码。

sudo apt install mysql-server

找到密码

sudo cat /etc/mysql/debian.cnf

显示如下:

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = RxvvvvviF84DDkfc
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = RxvvvvviF84DDkfc
socket   = /var/run/mysqld/mysqld.sock

这里得到用户名和密码,登录一下

mysql -u debian-sys-maint -p RxvvvvviF84DDkfc

然后修改一下密码

set password for 'debian-sys-maint'@localhost = password('S@#@$123456');