一、mysal 压缩文件通过ftp 放入\opt-->解压
cd /opt tar -xzvf mysql-5.7.29-linux-glibc2.12-×86_64.tar.gz
二、移动一>创建data 目录一>创建用户组
mv mysql-5.7.29-linux-glibc2.12-×86_64 /usr/local cd /usr/local mv mysql-5.7.29-linux-glibc2.12-×86_64 mysql cd /usr/local/mysql mkdir data groupadd mysql useradd -r -g mysql mysql
三、编辑my.cnf,拷贝如下配置文件vi /etc/my.cnf
[mysald] basedir=/usr/local/mysql datadir=/usr/local/mysql/data port = 3306 socket=/tmp/mysql.sock symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/tmp/mysqld/mysqld.pid sqL_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY,ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' [client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] log-bin=mysql-bin binlog-format=ROW server_id=1 max_connections=1000 init_connect='SET collation connection=utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake
四、mysql.sock、mysqld,初始化、安全启动
cd /tmp touch mysql.sock chown mysql:mysql mysql.sock chmod 755 mysql.sock mkdir mysald cd /tmp/mysqld touch mysqld.pid cd .. chown -R mysql:mysql mysqld cd mysqld chmod 755 mysqld.pid cd /var/log touch /var/log/mysqld.log cd .. chown -R mysql:mysql /var/log cd log chmod 755 mysqld.log cd /usr/local/mysql/bin/ ./mysqld --initialize --user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data ./mysqld_safe --user=mysql &
五、获取密码
cat /var/log/mysqld.log |grep password
六、启动mysql
cd /user/local/mysql/bin/ ./mysql -u root -p
七、更换root初始密码
set password=password("root mm"); grant all privileges on * * to 'root'@'%' identified by 'root mm';
flush privileges;
八、设置开机启动+创建快捷方式
cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql chkconfig --add mysql In -s /usr/local/mysql/bin/mysql /usr/bin In -s /usr/local/mysql/bin/mysqladmin /usr/bin
九、创建mysql数据库—>创建用户一—>权限控制
create database db1; create user 'u1'@'%' identified by 'm1' grant all privileges on u1.* to 'm1'@'%' identified by 'm1' with grant option; flush privileges
标签:log,数据库,MySql,离线,cd,mysqld,usr,mysql,local From: https://www.cnblogs.com/songwmeta/p/17555142.html