機器用的debian 7.wheezy系統。其他系統就不寫了。過程一樣。centos與redhat 部分安裝完程序命令部分爲mysqld
source.list設置部分前面有說。就不說了。
sudo apitude mysql-server;sudo apitude mysql-client;
安裝過程中會要求輸入密碼。輸入root
安裝完成以後。
修改配置文件,去掉綁定代碼
vim /etc/mysql/my.conf
#bind_address = 127.0.0.1
mysql -h localhost -u root -proot
注意這裏-proot是 緊靠在一起的。root爲密碼。
不出意外會提示
mysql>命令行。說明登錄成功。
新建1個用戶.
create user watsy identified by 'hellomysql';
新建1個數據庫
create database hellomysqldb;
grant all privileges on *.* to watsy@'localhost' identified by 'hellomysql' with grant option;
grant all privileges on `hellomysqldb`.* to watsy@'%' identified by 'hellomysql' with grant option;
flush privileges;
執行完以後退出mysql
exit
重啓mysql數據庫
sudo /etc/init.d/mysql restart
遠程執行
mysql -h remoteip -u watsy -phellomysql
不出意外,可以登錄了。
以上代碼爲記憶寫岀。有問題歡迎留言。