MySQL安装(Ubuntu系统)

目录
  1. 安装
  2. 配置
  3. 大小写

安装

1
apt-get install mysql-server

安装过程中输入root账号密码 rootpassword

配置

因为安装成功后通常只有本地root账户,所以需配置远程用户。

1
2
3
4
5
6
7
mysql -u root -u rootpassword
GRANT ALL PRIVILEGES ON *.* TO username@localhost IDENTIFIED BY 'password' WITH GRANT OPTION;
或者
INSERT INTO user VALUES('%','username',PASSWORD('password'), 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
flush privileges;//使修改生效

大小写

Ubuntu安装mysql后发现大小写敏感

1
2
3
4
5
6
7
8
9
10
11
12
13
14
mysql> show variables like "%case%";
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
+------------------------+-------+
修改/etc/mysql/my.cnf
[mysqld]的后面加
lower_case_table_names=1
0,区分大小写; 1,不区分
重启mysql sudo service mysql restart