安装方式:
- 通过APT方式安装
- 通过下载离线安装包DEB Bundle进行安装
- 通过tar.gz压缩包进行安装 Installing MySQL on Unix/Linux Using Generic Binaries
通过tar.gz压缩包进行安装
-
检查是否安装Mysql
rpm -qa | grep mysql
-
解压
tar -xvzf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz tar -zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
-
添加系统mysql组和mysql用户:
groupadd mysql useradd -r -g mysql mysql 重复执行命令: groupadd: group 'mysql' already exists useradd: user 'mysql' already exists
-
更改目录权限
-
mysqld
The program 'mysqld' can be found in the following packages
-
安装mysql
mkdir mysql-files chown mysql:mysql mysql-files chmod 750 mysql-files bin/mysqld --initialize --user=mysql 注意这里会产生一条root身份的临时登录密码,登录之后一定要记得改密码 临时密码类似下面格式: A temporary password is generated for root@localhost: yNThKHUuC6*O bin/mysql_ssl_rsa_setup bin/mysqld_safe --user=mysql & cp support-files/mysql.server /etc/init.d/mysql.server export PATH=$PATH:/usr/local/mysql/bin
-
登录mysql之后,更改root密码:
mysql -uroot -p 登录root,第一次需要临时密码 SET PASSWORD = PASSWORD('123456'); ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; flush privileges;
-
mysql查询开放端口:
show global variables like 'port';
-
添加具体的用户名可以进行远程数据库连接
GRANT ALL PRIVILEGES ON *.* TO 'arison'@'%' IDENTIFIED BY '13266699268' WITH GRANT OPTION;
-
mysql查询远程连接地址信息:
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
-
mysql 用数据库
use aliyun-0516
-
Linux 查询端口信息
iptables -nL --line-number
网友评论