Ubuntu 下安装Mysql 需要注意的地方.

安装卸载

sudo apt-get autoremove --purge mysql-server-5.0
sudo apt-get remove mysql-server
sudo apt-get autoremove mysql-server
sudo apt-get remove mysql-common //这个很重要

sudo apt-get install mysql-server

sudo apt-get install mysql-client

sudo apt-get install php5-mysql 

 

配置mysql允许远程连接

sudo vi /etc/mysql/my.cnf,在[mysqld] bind_address=127.0.0.1     # 注释掉这一行 , 否则远程连接可能会连接不上.

GRANT ALL PRIVILEGES ON 表名.* TO t_dy_root@"%" IDENTIFIED BY "密码";   # 添加一个用户,任意主机可以连接
flush privileges; # 刷新权限

 

mysql密码重置

sudo vi /etc/mysql/my.cnf,在[mysqld]段中加入一行“skip-grant-tables”

sudo service mysql restart,重启mySQL服务

sudo mysql -u root -p mysql,用空密码进入mysql管理命令行

use mysql    #切换数据库

update user set password=password("新密码") where user="root";  #设置新密码

 

phpMyAdmin连接多台主机的MySql

修改config.inc.php文件

$i++;
$cfg['Servers'][$i]['verbose'] = 'host1';          # 第一个主机, verbose 是显示的主机名字
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['compress'] = true;


$i++;
$cfg['Servers'][$i]['verbose'] = 'host2';       # 第二个主机, verbose 是显示的主机名字
$cfg['Servers'][$i]['host'] = 'x.x.x.x';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['compress'] = true;

 

 

 

 

 

 

http://www.okbt.net/ 磁力搜索引擎

 

posted on 2015-09-06 16:53  技术小站  阅读(176)  评论(0编辑  收藏  举报

导航