mysql el7_mysql-5.7.23-el7-x86_64.tar安装配置

d673c98a34c20c6b9590bb5c4a38f055.png

5a1904cacee1ee9d7a3b3ac0ddbe1b1e.png

下载好后,解压,我这里把mysql-5.7.23-el7-x86_64.tar 改名成了mysql5.7.23.tar.gz

5f9dcba8e9843d4edab9001b537badef.png

解压后有两个解压包,只管mysql-5.7.23-el7-x86_64.tar.gz这个包,另一个是测试包不用管

[root@git /]# ls /bin boot dev etc home lib lib64 media mnt mysql5.7.23.tar.gz opt proc root run sbin srv sys tmp usr var[root@git/]# tar -xf mysql5.7.23.tar.gz

[root@git/]# ls

bin dev home lib64 mnt mysql5.7.23.tar.gz opt root sbin sys usr

boot etc lib media mysql-5.7.23-el7-x86_64.tar.gz mysql-test-5.7.23-el7-x86_64.tar.gz proc run srv tmp var[root@git/]# useradd -s /bin/false -d /usr/local/mysql/mysql

//创建用户

[root@git/]# mkdir -p /usr/local/mysql/data

[root@git bin]# chown-R mysql.mysql /usr/local/mysql

//创建目录 (这里没装过数据库是没有mysql这个目录的)

[root@git/]# tar -xf mysql-5.7.23-el7-x86_64.tar.gz

[root@git/]# cd mysql-5.7.23-el7-x86_64/[root@git mysql-5.7.23-el7-x86_64]# ls

bin COPYING docs include lib man README share support-files

[root@git mysql-5.7.23-el7-x86_64]# cd bin/[root@git bin]# ls

innochecksum my_print_defaults mysql_config mysqldump mysqlpump mysql_tzinfo_to_sql resolve_stack_dump

lz4_decompress mysql mysql_config_editor mysqldumpslow mysql_secure_installation mysql_upgrade zlib_decompress

myisamchk mysqladmin mysqld mysql_embedded mysqlshow mysqlxtest

myisam_ftdump mysqlbinlog mysqld-debug mysqlimport mysqlslap perror

myisamlog mysqlcheck mysqld_multi mysql_install_db mysql_ssl_rsa_setup replace

myisampack mysql_client_test_embedded mysqld_safe mysql_plugin mysqltest_embedded resolveip

[root@git bin]# yum-y install libaio gcc make//安装依赖包

[root@git bin]# ./mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize2018-08-03T08:22:14.766220Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation formore details).2018-08-03T08:22:14.768375Z 0 [ERROR] Can't find error-message file'/usr/local/mysql/share/errmsg.sys'. Check error-message file location and'lc-messages-dir'configuration directive.

2018-08-03T08:22:15.280059Z 0 [Warning] InnoDB: New log files created, LSN=45790

2018-08-03T08:22:15.372315Z 0[Warning] InnoDB: Creating foreign key constraint system tables.2018-08-03T08:22:15.435202Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 543f3d19-96f6-11e8-a609-525400603f3a.2018-08-03T08:22:15.486161Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed'cannot be opened.2018-08-03T08:22:15.486770Z 1 [Note] A temporary password is generated for root@localhost: wM

修改配置

[root@git /]# vim /etc/my.cnf

[mysqld]

#skip-grant-tables

secure_file_priv="/usr/local/mysql"port= 3306basedir= /usr/local/mysql

datadir= /usr/local/mysql/data

socket=/tmp/mysql.sock

pid-file=/usr/local/mysql/data/mysql.pid

log-error=/usr/local/mysql/data/error.log

character_set_server=utf8

user=mysql

max_connections=1500symbolic-links=0

!includedir /etc/my.cnf.d

启动

[root@git mysql-5.7.23-el7-x86_64]# pwd/mysql-5.7.23-el7-x86_64

[root@git mysql-5.7.23-el7-x86_64]# ls

bin COPYING docs include lib man README share support-files

[root@git mysql-5.7.23-el7-x86_64]# cp support-files/mysql.server /etc/init.d/mysqld

[root@git mysql-5.7.23-el7-x86_64]# cp -r bin/ /usr/local/mysql/[root@git mysql-5.7.23-el7-x86_64]# chown -R mysql:mysql /usr/local/mysql/[root@git mysql-5.7.23-el7-x86_64]# cd /[root@git/]# /etc/init.d/mysqld restart

Shutting down MySQL.. SUCCESS!Starting MySQL. SUCCESS!

修改密码

[root@git /]# cd /usr/local/mysql/bin/[root@git bin]# ls

innochecksum my_print_defaults mysql_config mysqldump mysqlpump mysql_tzinfo_to_sql resolve_stack_dump

lz4_decompress mysql mysql_config_editor mysqldumpslow mysql_secure_installation mysql_upgrade zlib_decompress

myisamchk mysqladmin mysqld mysql_embedded mysqlshow mysqlxtest

myisam_ftdump mysqlbinlog mysqld-debug mysqlimport mysqlslap perror

myisamlog mysqlcheck mysqld_multi mysql_install_db mysql_ssl_rsa_setup replace

myisampack mysql_client_test_embedded mysqld_safe mysql_plugin mysqltest_embedded resolveip

[root@git bin]# ./mysql -uroot -p

Enter password:

密码忘记修改

1.

2.修改MySQL的登录设置:

# vim/etc/my.cnf

在[mysqld]的段中加上一句:skip-grant-tables

例如:

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

skip-grant-tables

保存并且退出vi。3.重新启动mysqld

# service mysqld restart

Stopping MySQL: [ OK ]

Starting MySQL: [ OK ]4.登录并修改MySQL的root密码

# mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection idis 3 to server version: 3.23.56Type'help;' or '\h' for help. Type '\c'to clear the buffer.

mysql>USE mysql ;

Database changed

mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root';

Query OK,0 rows affected (0.00sec)

Rows matched:2 Changed: 0 Warnings: 0mysql>flush privileges ;

Query OK,0 rows affected (0.01sec)

mysql> quit

2.

set password for root@localhost = password('123456');

如果报错需要先执行

flush privileges;

mysql 全目录可执行

ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

如果换用户无法访问,检查有无访问链接路径的权限

阿里云需要配置安全组规则,开放3306端口

详见https://blog.csdn.net/wei389083222/article/details/78286629

mysql8安装包以及安装说明,在centeros7下的安装.解压缩后会有两个文件:mysql-8.0.18-1.el7.x86_64.rpm-bundle.tarmysql8安装说明.txt 1、安装 rpm -i 需要安装的包文件名 举例如下: rpm -i example.rpm 安装 example.rpm 包; rpm -iv example.rpm 安装 example.rpm 包并在安装过程中显示正在安装的文件信息; rpm -ivh example.rpm 安装 example.rpm 包并在安装过程中显示正在安装的文件信息及安装进度; 2、查看安装完成的软件 rpm -qa | grep mysql mysql-community-libs-5.7.24-1.el7.x86_64 mysql-community-common-5.7.24-1.el7.x86_64 mysql-community-client-5.7.24-1.el7.x86_64 mysql-community-server-5.7.24-1.el7.x86_64 3、卸载软件 rpm -e --nodeps 要卸载的软件包 rpm -e --nodeps mysql-community-libs-5.7.24-1.el7.x86_64 rpm -e --nodeps mysql-community-common-5.7.24-1.el7.x86_64 rpm -e --nodeps mysql-community-client-5.7.24-1.el7.x86_64 rpm -e --nodeps mysql-community-server-5.7.24-1.el7.x86_64 看看系统中有没有自带有mysql的东西,有就先删除掉。 查看: find / -name mysql 删除: rm -rf 上边查找到的路径,多个路径用空格隔开 #或者下边一条命令即可 find / -name mysql|xargs rm -rf; mkdir -p /usr/local/mysql8 cd /usr/local/mysql8 ll 将下载的资源包(mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar)上传到 usr/local/mysql8 目录下,并解压 tar -xvf mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar 依次安装 rpm -ivh mysql-community-common-8.0.15-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-8.0.18-1.el7.x86_64.rpm rpm -ivh mysql-community-client-8.0.18-1.el7.x86_64.rpm rpm -ivh mysql-community-server-8.0.18-1.el7.x86_64.rpm 查看已安装资源 rpm -qa | grep mysql groupadd mysql useradd -g mysql mysql mysqld --initialize 初始化 chown mysql:mysql /var/lib/mysql -R 授权 systemctl start mysqld 开启mysql服务 systemctl status mysqld 查看mysql 状态 cat /var/log/mysqld.log | grep password 查看root初始密码 使用root用户登录mysql ,并修改root用户密码 mysql -u root -p #回车之后输入前面的初始密码也就是 XXXXXX(填自己的密码) ALTER USER "root"@"localhost" IDENTIFIED BY "自己的密码"; FLUSH PRIVILEGES; #立即生效 再次用户root 用户登录 输入自己刚刚修改的密码就可以了 远程连接 use mysql; update user set host = '%' where user ='root'; ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #更改加密方式 ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '自己的密码'; #更新用户密码 (我这里为root )
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值