首先需要下載mysql
下載地址爲:https://www.mysql.com/downloads/
下載之後爲tar文件,
這裏是用的5.7.19版本 mysql-server_5.7.19-1ubuntu14.04_amd64.deb-bundle.tar
在服務器上先解壓這個tar文件 #tar -xvf 文件
解壓之後:
libmysqlclient-dev_5.7.19-1ubuntu14.04_amd64.deb
libmysqld-dev_5.7.19-1ubuntu14.04_amd64.deb
mysql-client_5.7.19-1ubuntu14.04_amd64.deb
mysql-common_5.7.19-1ubuntu14.04_amd64.deb
mysql-community-client_5.7.19-1ubuntu14.04_amd64.deb
mysql-community-server_5.7.19-1ubuntu14.04_amd64.deb
mysql-community-source_5.7.19-1ubuntu14.04_amd64.deb
mysql-community-test_5.7.19-1ubuntu14.04_amd64.deb
mysql-server_5.7.19-1ubuntu14.04_amd64.deb
mysql-testsuite_5.7.19-1ubuntu14.04_amd64.deb
安裝可能會出現依賴不完整 可以用 sudo apt-get -f install
輸入mysql的密碼,即可;
查看是否安裝成功:
service mysql start
需要遠程鏈接的需要先改 /etc/mysql/mysql.conf.d 目錄下的 mysqld.cnf 文件
將# bind-address= 127.0.0.1 注掉即可;
然後在給root 賦予遠程鏈接的權限; username:用戶名; password:密碼
grant all on *.* to username@"%" Identified by "password";
flush privileges;