Linux下数据库安装
数据库一定要经常做备份
数据库一定要经常做备份
数据库一定要经常做备份
在服务器上记得让数据库开机就启动
MYSQL远程连接失败:ERROR 1130: mysql 1130连接错误的有效解決方法
卸载 centos 中预安装的 mysql
rpm -qa | grep -i mysql
rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps
使用rpm来安装MySQL 8
//下载mysql源安装包
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
//安装mysql源
yum localinstall mysql80-community-release-el7-3.noarch.rpm
yum install mysql-devel
//安装MySQL
sudo yum install mysql-server
//启动Mysql
systemctl start mysqld
//查看MySQL的启动状态
systemctl status mysqld
//开机启动
systemctl enable mysqld
//查看初始密码
grep ‘temporary password‘ /var/log/mysqld.log
//进入Mysql设置密码
mysql -u root -p
//修改初始化密码(密码一定要大小写字母+数字+符号,如:Aa-123456789)
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘@Xingkong22‘;
//导入数据库数据
chmod 777 SearchAndNavAPP.sql//先给权限
source project/SearchAndNavAPP.sql;
//关于Navicat连接阿里云MySQL拒绝访问的问题
配置阿里云添加规则3306端口
远程连接
注意服务器要开放3306端口
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
sudo firewall-cmd --reload
//先更mysql数据库中的user
//允许别的客户端获取别的IP连接这个数据这一步必须设置
use mysql;
update user set host=‘%‘ where user=‘root‘;
//执行两次
GRANT ALL ON *.* TO ‘root‘@‘%‘;
Mysql指令
Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器。
systemctl start mysqld.service
systemctl stop mysqld.service
systemctl restart mysqld.service
systemctl status mysqld.service
//设置mysql服务开机自启动
systemctl enable mysqld.service
//停止mysql服务开机自启动
systemctl disable mysqld.service