机器用的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
不出意外,可以登录了。
以上代码为记忆写岀。有问题欢迎留言。