MySQL 5.7.24免cmake部署

### 1、安装mysql ``` wget -P /data/package https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz ``` ### 下载mysql安装包,解压到/usr/local/mysql ``` sudo groupadd mysql sudo useradd -g mysql mysql -s /bin/false mkdir -p /data/logs/software/mysql mkdir -p /data/databases/mysql sudo chown mysql.mysql /data/software/mysql -R sudo chown mysql.mysql /data/databases/mysql -R sudo chown mysql.mysql /data/logs/software/mysql -R ``` ### 启动配置文件 ``` /etc/my.cnf ``` ### 启动脚本 ``` cp /data/software/mysql/support-files/mysql.server /etc/init.d/mysqld ``` ### 需更改66行,Basedir ``` /etc/init.d/mysqld -- 更改 66 basedir=/data/software/mysql ![image.png](http://www.icode9.com/i/li/?n=2&i=images/20210621/1624247975748911.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=) ``` ### mysql环境变量 ``` vim ~/.bash_profile PATH=$PATH:$HOME/bin:/data/software/mysql/bin/ ``` ### 初始化mysql ``` /data/software/mysql/bin/mysqld --defaults-file=/etc/my.cnf --basedir=/data/software/mysql --datadir=/data/databases/mysql/data --initialize-insecure ``` ### 启动MySQL ``` /etc/init.d/mysqld start ``` ### 给root创建密码 ``` update mysql.user set authentication_string=password('password') where user='root'; flush privileges; ``` ### 服务自启动 ``` chkconfig mysqld on chkconfig --add /etc/init.d/mysqld systemctl enable mysqld ```
上一篇:单词记忆微信小程序的设计与实现毕业论文+小程序前后台(JavaSSM)源码及数据库


下一篇:linux安装mysql数据库