mysql 安装

windows 下安装mysql

http://www.cnblogs.com/lmh2072005/p/5656392.html

mac下安装mysql

使用安装包安装 https://www.jianshu.com/p/a3d38205d785

https://www.jb51.net/article/112820.htm

使用brew安装:

https://www.jianshu.com/p/c64e309330a5

启动MySQL服务 sudo /usr/local/mysql/support-files/mysql.server start

停止MySQL服务 sudo /usr/local/mysql/support-files/mysql.server stop

重启MySQL服务 sudo /usr/local/mysql/support-files/mysql.server restar

1.Ubuntu下安装mysql

apt update

sudo apt-get install mysql-server mysql-client

然后按照提示输入

111
ab455601-9220-4888-86b8-fd88e8e65798

管理服务

启动

service mysql start

或则

systemctl start mysql

停止

service mysql stop

或则

systemctl stop mysql

重启

service mysql restart

或则

systemctl restart mysql

查看mysql服务状态

service mysql status

或则

systemctl status mysql

允许远程连接

找到mysql配置文件并做如下修改:允许远程连接

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

将 bind-address=127.0.0.1 注释掉

或则修改为bind-address= 0.0.0.0

DeepinScrot-2246

授权root用户可以从任何地点登录

首先登录系统

mysql -h localhost -u root -p

授权root用户

GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;

刷新权限

FLUSH PRIVILEGES;

退出命令行

exit

DeepinScrot-2229

注意: 如果安装过程中忘记输入密码,在此文件中查看(mysql)为你随机生成的默认的账号密码: sudo vim /etc/mysql/debian.cnf

DeepinScrot-4631

密码会随即给一个很复杂的,这个时候,要进入MySQL的话,就是需要在终端把root更改为debian-sys-maint

mysql -u debian-sys-maint -p

如果要修改,先使用默认账号登录然后输入一下命令:

update mysql.user set authentication_string=password('password') where user='root'and Host = 'localhost';

修改成功后重启便可以登录便可以使用账号密码登录

删除mysql

sudo apt-get autoremove --purge mysql-server-5.7 sudo apt-get remove mysql-server sudo apt-get autoremove mysql-server sudo apt-get remove mysql-common

清理数据 dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

你可能感兴趣的:(mysql 安装)