内容发布更新时间 : 2024/12/23 9:43:28星期一 下面是文章的全部内容请认真阅读。
Linux利用rpm包安装mysql5.7.15
Mysql安装的三种模式:rpm包安装、二进制安装和源码安装三种,其中rpm包安装最为简单,本文档只讲述该安装方式
1.mysql用户创建
groupaddmysql; useradd–g mysqlmysql
2.mysql安装包的上传与解压
利用ftp工具将mysql的安装包上传
利用tar工具进行解压
3.mysql安装
可根据实际需要选择进行相应rpm包的安装,本手册主要安装server和client两个rpm包,该包以来common和libs包,具体的安装顺序如下:
4.配置文件位置及查看
安装完毕后会自动在/etc目录下面生成一个my.cnf的配置文件 cat /etc/my.cnf
5.生成的root的密码通过查看日志
根据上述的my.cnf查看知悉mysql的日志为mysqld.log,位置在/var/log/,可打开直接搜索A temporary password is generated for root@localhost:查看初始化密码,一般在日志的前几行比较考前,如下红色框即为root的初始化密码
6、启动及系统初始化
(1)启动 Service mysqld start (2)初始化
使用mysql_secure_installation进行初始化的设置mysql_secure_installation命令的地址为/usr/bin,执行如下
/usr/bin/mysql_secure_installation New password: --更换root用户密码 Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y—删除自带用户
Success.
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y—是否只在mysql服务器上使用root用户登录
Success.
By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing,