安装步骤
下载MySQL二进制包
下载地址: mysql-5.6.28-linux-glibc2.5-x86_64.tar.gz
创建用户和组
1 2
| [root@shark] [root@shark]
|
解压安装MySQL
1 2 3
| [root@shark] [root@shark] [root@shark]
|
修改MySQL的各级文件夹和文件的创建者、创建组为mysql
1 2 3
| [root@shark] [root@shark] [root@shark]
|
提示:”.”代表的就是当前目录,选项-R表示递归当前目录及其子目录
初始化MySQL
1 2
| [root@shark] [root@shark]
|
提示:初始化时,有可能会报错误,安装需要的包即可:libstdc++.so.6和libaio.so.1和libncurses.so.5
修改配置文件
1 2
| [root@shark] [root@shark]
|
在[mysqld]中添加:
1 2 3 4
| basedir = /usr/local/mysql datadir = /usr/local/mysql/data port = 3306 server_id = 1
|
启动mySQL服务
登陆MySQL并且删除空用户,并设置root账户密码,开启root远程访问权限等
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| [root@shark] …… mysql> use mysql; mysql> SELECT user, host, password FROM mysql.user; +------+-----------+----------+ | user | host | password | +------+-----------+----------+ | root | localhost | | | root | 10-4-5-9 | | | root | 127.0.0.1 | | | root | ::1 | | | | localhost | | | | 10-4-5-9 | | +------+-----------+----------+ 6 rows in set (0.00 sec) mysql> UPDATE mysql.user set password = PASSWORD('123456') WHERE user = 'root'; mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "123456"; //为root添加远程连接的能力,123456为root账户密码 mysql> DROP USER ''@localhost; mysql> FLUSH PRIVILEGES;
|