-------------------win 7 ----------------------------------
1、下载MySql mysql-installer-community-5.6.10.1.msi
http://dev.mysql.com/downloads/
2、点击安装
1)默认端口为3306。
2)数库服务名MySql。
3、测试MySql
net start MySql
net stop MySql
--------------linux ----------------------------------------
1、下载
http://www.mysql.com
tar zxf mysql-5.1.22-rc-linux-i686-glibc23.tar.gz
为mysql的运行建立mysql用户和mysql用户组
groupadd mysql
useradd -g mysql mysql
./configure --prefix=/usr/local/mysql
make
make install
cp support-files/my-medium.cnf /etc/my.cf
bin/mysql_install_db --user=mysql //用mysql生成初始数据库,出现类似thank for using mysql 证明初始化数据库成功。
chown -R root . //当前目录给root
chown -R mysql var //var给mysql,这个很重要,也是安全起见
chgrp -R mysql .
bin/mysqld_safe --user=mysql &
bin/mysql –u root
此时安全完毕,但是最重要是对MySQL进行安全配置,检查你的系统,最基本要做到以下配置。
--------------centos8 ----------------------------------------
centos8安装mysql5.6
1、下载安装
http://www.mysql.com
tar -xvf mysql-5.6.51-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.51-linux-glibc2.12-x86_64 /usr/local/mysql
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
yum install libncurses* -y
2、设置目录权限
mkdir -p /data/mysql
chown -R mysql..mysql /data/mysql/
chown -R mysql.mysql /usr/local/mysql
3、配置mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
vim /etc/my.cnf 修改配置
./scripts/mysql_install_db -user=mysql -datadir=/data/mysql
4、开机启动
chkconfig --add mysqld
chkconfig mysqld on
5、启动服务
/etc/init.d/mysqld start
6、设置密码
/usr/local/mysql/bin/mysqladmin -u root password '新密码'
7、测试登录
mysql -u root -p
8、建立远程root用户
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你设置的密码' WITH GRANT OPTION;
mysql> flush privileges;