npm run dev 等同于 pm2 start npm -- run dev npm start 等同于 pm2 start npm -- start # 命名进程名 pm2 start npm --name test -- run dev pm2 start npm --name test -- start # 查看 pm2 list # 重载进程 pm2 reload <id>
[mysql] # 客户端默认字符集 default-character-set=utf8mb4 [client] port=3306 socket=/var/lib/mysql/mysql.sock [mysqld] port=3306 server-id=3306 user=mysql datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # 设置mysql的安装目录 basedir=/data01/mysql/mysql-8.0.25 #你自己的安装路径 # 设置mysql数据库的数据的存放目录 datadir=/data/mysqldata/mysql #你自己创建的数据库文件存放路径 log-bin=/data/mysqldata/mysql/mysql-bin innodb_data_home_dir=/data/mysqldata/mysql innodb_log_group_home_dir=/data/mysqldata/mysql character-set-server=utf8mb4 lower_case_table_names=1 autocommit=1 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd
[root@10-9-66-224 bin]# ./mysqld --defaults-file=/etc/my.cnf --basedir=/data01/mysql/mysql-8.0.25/ --datadir=/data/mysqldata/mysql --user=mysql --initialize 2021-10-26T01:51:48.835319Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release. 2021-10-26T01:51:48.835415Z 0 [System] [MY-013169] [Server] /data01/mysql/mysql-8.0.25/bin/mysqld (mysqld 8.0.25) initializing of server in progress as process 127026 2021-10-26T01:51:48.903706Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2021-10-26T01:51:52.076838Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2021-10-26T01:51:53.498736Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: dj7=M4ajHok1
# 登录 mysql -u root -p # 输入上述保存的初始化密码(dj7=M4ajHok1) # 修改root密码 修改root用户只能本地连接 ALTER USER 'root'@'localhost' IDENTIFIED with mysql_native_password BY '新密码'; # 刷新权限 flush privileges;
创建用户
1 2 3 4
# 创建用户任意远程访问 CREATE USER 'seachan'@'%'; # 修改密码 ALTER USER 'seachan'@'%' identified with mysql_native_password by '新密码';
创建数据库
1 2
create database mag default character set utf8mb4 collate utf8mb4_unicode_ci; # create database 数据库名 default character set utf8mb4 collate utf8mb4_unicode_ci;
授权
1 2 3 4
# 将 mag 库的所有权限赋予 seachan 用户 grant all privileges on mag.* to "seachan"@"%"; # 刷新权限 flush privileges;
Navicat 远程测试
扩展-开机自启动
1 2 3 4 5 6 7 8 9 10 11 12
#1.查看是否有mysql服务 chkconfig --list #2.进入mysql软件目录,复制mysql.server文件到 /etc/rc.d/init.d目录下 cp /data01/mysql/mysql-8.0.25/support-files/mysql.server /etc/rc.d/init.d/mysql #3.给/etc/rc.d/init.d/mysql赋权可执行权限 chmod +x /etc/rc.d/init.d/mysql #4.添加mysql服务 chkconfig --add mysql #5.使mysql服务开机自启 chkconfig --level 345 mysql on #6.查看MySQL服务 ,重启服务器,测试是否成功。 chkconfig --list