linux(ubuntu) 安装mysql 步骤整合(记录)


删除已安装的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 

清理残留数据
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
</pre><p>安装mysql:</p><pre code_snippet_id="492728" snippet_file_name="blog_20141022_4_5574634" name="code" class="plain">sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install php5-mysql(用于连接php和mysql)

查看mysql是否运行
ps aux | grep mysql

启动命令
/etc/init.d/mysql start

修改编码

修改/etc/my.cnf 中的设置,在[client]节点下添加  

default-character-set=utf8 

在[mysqld]节点下添加 

character-set-server=utf8 
collation-server=utf8_general_ci


开放远程连接权限

将/etc/my.cnf 中的 bind-address = 127.0.0.1 用 '#' 注掉

执行命令 

mysql

执行sql

use mysql;
update user set host = '%' where user = 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值