侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

用RPM包安装MySQL

2023-11-14 星期二 / 0 评论 / 0 点赞 / 39 阅读 / 3223 字

准备好安装文件MySQL-5.6.32-1.el6.x86_64.rpm-bundle.tar tar -zxvf MySQL-5.6.32-1.el6.x86_64.rpm-bundle.tar 解

 

准备好安装文件 MySQL-5.6.32-1.el6.x86_64.rpm-bundle.tar

tar -zxvf MySQL-5.6.32-1.el6.x86_64.rpm-bundle.tar

解压后

使用日下命令进行安装

rpm -ivh MySQL-server-5.6.32-1.el6.x86_64.rpm MySQL-devel-5.6.32-1.el6.x86_64.rpm MySQL-client-5.6.32-1.el6.x86_64.rpm MySQL-embedded-5.6.32-1.el6.x86_64.rpm MySQL-shared-5.6.32-1.el6.x86_64.rpm MySQL-shared-compat-5.6.32-1.el6.x86_64.rpm

 启动mysql服务

service mysql start

查看mysql初始化密码

cat /root/.mysql_secret

更改datadir于合适的位置

mkdir /home/data/mysqlchmod -R 755 /home/data/mysql

编辑/etc/my.cnf

vi /etc/my.cnf

粘贴如下片段

# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the# *** default location during install, and will be replaced if you# *** upgrade to a newer version of MySQL.[mysqld]lower_case_table_names=1socket=/var/lib/mysql/mysql.sockmax_allowed_packet=400Mskip-name-resolve[mysql.server]user=mysqldatadir=/home/data/mysqlymbolic-links=0character_set_client=utf8default-character-set=utf8character-set-server=utf8character-set-filesystem=utf8# Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128M# Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin# These are commonly set, remove the # and set as required.# basedir = .....# datadir = .....# port = .....# server_id = .....# socket = .....# Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2Msql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

启动mysql

service mysql start

修改mysql密码:

1.用root 进入mysql后

mysql>set password =password('你的密码');mysql>flush privileges;

2.使用GRANT语句

mysql>grant all on *.* to 'root'@'localhost' IDENTIFIED BY '你的密码'with grant option ;mysql>flush privileges;

 3.进入mysql库修改user表

mysql>use mysql;mysql>update user set password=password('你的密码') where user='root'; mysql>flush privileges;

 

广告 广告

评论区