记一次MySQL rpm 方式安装

1. 下载MySQL rpm包

wget https://cdn.mysql.com/archives/mysql-5.6/MySQL-server-5.6.49-1.el7.x86_64.rpm
wget https://cdn.mysql.com/archives/mysql-5.6/MySQL-client-5.6.49-1.el7.x86_64.rpm

2. 检查冲突

rpm -qa |grep -i mysql
rpm -qa |grep -i mariadb

#有冲突删除冲突版本
rpm -e mariadb-libs-5.5.56-2.el7.x86_64
# 如果因为依赖原因报错,请使用 yum remove
yum remove mariadb-libs-5.5.56-2.el7.x86_64

3. 安装MySQL

# 安装依赖
# rpm -ivh MySQL-server-5.6.49-1.el7.x86_64.rpm 
# warning: MySQL-server-5.6.49-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID # # # # 5072e1f5: NOKEY
# error: Failed dependencies:
#         perl(Data::Dumper) is needed by MySQL-server-5.6.49-1.el7.x86_64
# 
yum install -y perl perl-devel autoconf libaio

rpm -ivh MySQL-client-5.6.49-1.el7.x86_64.rpm
rpm -ivh MySQL-server-5.6.49-1.el7.x86_64.rpm 

# 检查是否成功
ps -ef |grep mysql

#成功结果

2020-12-11 12:27:01 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-12-11 12:27:01 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2020-12-11 12:27:01 0 [Note] /usr/sbin/mysqld (mysqld 5.6.49) starting as process 20642 ...
2020-12-11 12:27:01 20642 [Note] InnoDB: Using atomics to ref count buffer pool pages
2020-12-11 12:27:01 20642 [Note] InnoDB: The InnoDB memory heap is disabled
2020-12-11 12:27:01 20642 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-12-11 12:27:01 20642 [Note] InnoDB: Memory barrier is not used
2020-12-11 12:27:01 20642 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-12-11 12:27:01 20642 [Note] InnoDB: Using Linux native AIO
2020-12-11 12:27:01 20642 [Note] InnoDB: Using CPU crc32 instructions
2020-12-11 12:27:01 20642 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2020-12-11 12:27:01 20642 [Note] InnoDB: Completed initialization of buffer pool
2020-12-11 12:27:01 20642 [Note] InnoDB: Highest supported file format is Barracuda.
2020-12-11 12:27:01 20642 [Note] InnoDB: 128 rollback segment(s) are active.
2020-12-11 12:27:01 20642 [Note] InnoDB: Waiting for purge to start
2020-12-11 12:27:01 20642 [Note] InnoDB: 5.6.49 started; log sequence number 1625977
2020-12-11 12:27:01 20642 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2020-12-11 12:27:01 20642 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2020-12-11 12:27:01 20642 [Note] Binlog end
2020-12-11 12:27:01 20642 [Note] InnoDB: FTS optimize thread exiting.
2020-12-11 12:27:01 20642 [Note] InnoDB: Starting shutdown...
2020-12-11 12:27:03 20642 [Note] InnoDB: Shutdown completed; log sequence number 1625987




A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

4. 启动MySQL

service mysql start

5. 查看随机密码并修改

cat /root/.mysql_secret
# The random password set for the root user at Fri Dec 11 12:26:59 2020 (local time): Udg53cmYRQU2JJFU

mysql -u root -p

# 修改密码
set password=password(‘root’);

6. 创建外网访问用户及授权

grant all privileges on *.* to john@'%' identified by '123456';

 

7. 关于my.conf配置

可参见: linux mysql 5.6 内存过大的问题, L.G.F, 2018-09-07 16:46:33

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值