一、准备文件
mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
二、解压
$ tar mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
三、MySQL安装
1、进入mysql的安装路径
$ cd mysql-5.6.36-linux-glibc2.5-x86_64/
$ mkdir datadir
2、复制默认配置文件
$ cp support-files/my-default.cnf ./my.cnf
3、修改配置文件my.cnf
basedir = /home/sun_zeming/mysql/mysql-5.6.36-linux-glibc2.5-x86_64
datadir = /home/sun_zeming/mysql/mysql-5.6.36-linux-glibc2.5-x86_64/datadir
port = 6660
# server_id = .....
socket = /home/sun_zeming/mysql/mysql-5.6.36-linux-glibc2.5-x86_64/mysql.sock
4、安装mysql
$ ./scripts/mysql_install_db --user=root --defaults-file=/home/sun_zeming/mysql/mysql-5.6.36-linux-glibc2.5-x86_64/my.cnf
四、启动MySQL
$ ./bin/mysqld --defaults-file=/home/sun_zeming/mysql/mysql-5.6.36-linux-glibc2.5-x86_64/my.cnf
五、MySQL授权
1、设置root用户密码
$ ./bin/mysqladmin –h127.0.0.1 –P6660 -u root password "123456"
2、登录mysql
$ ./bin/mysql –h127.0.0.1 -P6660 -uroot -p123456
3、授权
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;