linux mysql 安装

mysql安装

  • 下载
1
2
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
rpm -Uvh mysql-community-release-el6-5.noarch.rpm
  • 安装
1
2
3
4
5
6
7
8
9
10
11
yum -y install mysql mysql-server
``

- 在配置文件中加入以下配置

```bash
vi /etc/my.cnf
lower_case_table_names=1
character_set_server=utf8
[client]
default-character-set=utf8
  • 启动
1
service mysqld start
  • 重启
1
service mysqld restart
  • 创建用户和实例(注意加分号!!!)
1
2
3
4
5
6
7
8
mysql -uroot -p

> use mysql;
> update user set password=PASSWORD('xxxx') where user='root';
> create user xxx@'%' identified by 'xxxx';
> create database xxxx;
> grant all privileges on *.* to xxxx@'%' identified by 'xxxx';
> flush privileges;