免费资源网 – https://freexyz.cn/
1、下载MySQL
#进入local目录 cd /usr/local/ #下载mysql wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz2、解压mysql修改名称
tar -zxvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql mkdir data3、添加用户和组
groupadd mysql useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql chown -R mysql.mysql /usr/local/mysql/4、安装命令
yum -y install libAIo-devel ./bin/mysql_install_db –user=mysql –basedir=/usr/local/mysql/ –datadir=/usr/local/mysql/data/ cp -a ./support-files/my-default.cnf /etc/my.cnf cp -a ./support-files/mysql.server /etc/init.d/mysqld5、修改配置文件
#打开配置目录 vi /etc/my.cnf #增加目录配置 basedir=/usr/local/mysql/ datadir=/usr/local/mysql/data6、启动,修改root密码,添加远程连接用户权限
#修改环境变量配置文件 vi /etc/profile #增加mysql全局变量,使service mysqld start可以在任意位置使用 export PATH=$PATH:/usr/local/mysql/bin #即时生效 source /etc/profile #启动mysql service mysqld start #mysql刚安装完毕没有密码进入mysql命令行 mysql -uroot -p #查询mysql用户 select User, Host, Password FROM mysql.user; #修改root密码 update mysql.user set password=password(root) where User=”root”; #为root添加远程权限 grant all privileges on *.* to root@%identified by root with grant option; #刷新权限 flush privileges;
免费资源网 – https://freexyz.cn/
© 版权声明
THE END
暂无评论内容