Ubuntu 18.08 安装mysql
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu 18.08 安装mysql相关的知识,希望对你有一定的参考价值。
1、安装mysql server
sudo apt-get install mysql-server
2、查看默认生成的密码
sudo cat debian.cnf
debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH! [client] host = localhost user = debian-sys-maint password = pASsYAUR2aRiaprZX socket = /var/run/mysqld/mysqld.sock [mysql_upgrade] host = localhost user = debian-sys-maint password = pASsYAUR2aRiaprZX socket = /var/run/mysqld/mysqld.sock
3、默认用户登录
mysql -u debian-sys-maint -p
4、修改root密码
mysql> use mysql; mysql> update user set authentication_string=password(‘123‘) where user=‘root‘ and Host =‘localhost‘; mysql> update user set plugin="mysql_native_password"; mysql> flush privileges; mysql> quit;
5、建立 测试用户
#创建测试用户 CREATE USER ‘demor‘@‘localhost‘ IDENTIFIED BY ‘123‘; #创建测试数据库 CREATE DATABASE demo; #添加权限 GRANT ALL PRIVILEGES ON demo.* to ‘demo‘@‘localhost‘ IDENTIFIED BY ‘123‘; #添加远程访问权限 GRANT ALL PRIVILEGES ON demo.* TO ‘demo‘@‘%‘ IDENTIFIED BY ‘123‘ WITH GRANT OPTION; #刷新 flush privileges;
以上是关于Ubuntu 18.08 安装mysql的主要内容,如果未能解决你的问题,请参考以下文章
续:纠正:ubuntu7.04可以安装,而且完美的安装 ! for《Oracle-10.2.0.1,打补丁10.2.0.5:在 debian 版本4不含4以上,及 ubuntu 7.04不含(代码片段