卸載:http://blog.csdn.net/ldy1016/article/details/49227247
centos7中安裝5.7(安裝8.0遠程登陸失敗。。。): https://www.linuxidc.com/Linux/2016-09/135288.htm
配置:
編輯根目錄下:/etc/my.conf,添加如下代碼
//跳過域名解析
skip-name-resolve
登錄后配置遠程登陸
use mysql
select host,user from user;//查看當前用戶
update user set host = '%' where user = 'root';
flush privileges;
啟動服務:
service mysqld start
重起服務:
service mysqld restart
設(shè)置密碼:
mysqladmin -u root password 'new-password' // 通過該命令給root賬號設(shè)置密碼為 new-password
或者
/usr/bin/mysqladmin -u root password 'new-password' // 為root賬號設(shè)置密碼
登錄mysql:
mysql -u root -p
然后輸入密碼,不會顯示密碼
創(chuàng)建一個數(shù)據(jù)庫
create database xh; //在/var/lib/mysql目錄下會生成xh文件夾
創(chuàng)建用戶:
mysql> insert into mysql.user(Host,User,Password) values("localhost","test",password("1234"));
這樣就創(chuàng)建了一個名為:test 密碼為:1234 的用戶。
注意:此處的"localhost",是指該用戶只能在本地登錄,不能在另外一臺機器上遠程登錄。如果想遠程登錄的話,將"localhost"改為"%",表示在任何一臺電腦上都可以登錄。也可以指定某臺機器可以遠程登錄。
存放位置
/var/lib/mysql;//數(shù)據(jù)庫文件存放位置:
/var/log ;//數(shù)據(jù)庫的日志輸出存放位置
推薦數(shù)據(jù)庫連接軟件:
MySQL-Front
以此記錄,方便日后再用,安裝成功后才記錄的,所以可能有遺漏點,執(zhí)行順序也可能不一樣,下面是記錄時參考的文章
http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html