二进制快速安装mysql5.6.35的步骤
admin
2023-05-18 20:02:15
0

本文主要给大家简单讲讲二进制快速安装mysql5.6.35的步骤,相关专业术语大家可以上网查查或者找一些相关书籍补充一下,这里就不涉猎了,我们就直奔主题吧,希望二进制快速安装mysql5.6.35的步骤这篇文章可以给大家带来一些实际帮助。

mysql5.6.35 二进制快速安装

mysql


说明:

mysql安装在/data/mysql-5.6.35目录下;

下载

cd /data/
wget 
tar -zxf  mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz 
mv mysql-5.6.35-linux-glibc2.5-x86_64 /data/mysql-5.6.35

新建mysql用户及设置权限

sudo useradd -s /sbin/nologin -M mysql
mkdir -pv  /data/mysql-5.6.35/{var,log}
touch /data/mysql-5.6.35/log/error.log
sudo chown -R mysql:mysql /data/mysql-5.6.35/

添加环境变量:

vim ~/.bash_profile
export PATH=/data/mysql-5.6.35/bin:$PATH
刷新一下环境
source ~/.bash_profile

初始化数据库,修改默认路径

cd /data/mysql-5.6.35/
sudo ./scripts/mysql_install_db --basedir=/data/mysql-5.6.35/ --datadir=/data/mysql-5.6.35/data/ --user=mysql

#如果安装在/usr/local/mysql/目录下,则两个sed不许执行,因为默认是/usr/local/目录下;
sudo sed -i 's#/usr/local/mysql#/data/mysql-5.6.35#g' /data/mysql-5.6.35/bin/mysqld_safe
sudo sed -i 's#/usr/local/mysql#/data/mysql-5.6.35#g' /data/mysql-5.6.35/support-files/mysql.server
sudo ln -s /data/mysql-5.6.35/bin/mysql /usr/bin

修改配置文件

sudo rm –f /etc/my.cnf
sudo vim /data/mysql-5.6.35/my.cnf
[client]
port       = 3306
socket   = /tmp/mysql.sock

[mysqld]
server-id  = 1
port      = 3306
basedir = /data/mysql-5.6.35
datadir  = /data/mysql-5.6.35/data
socket  = /tmp/mysql.sock
binlog-ignore-db  = mysql
log-bin  = /data/mysql-5.6.35/log/mysql-bin
innodb_file_per_table = 1
open_files_limit  = 65535
sql_mode  =NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
skip-host-cache
skip-name-resolve
max_connections  = 1024
wait_timeout  = 31536000
interactive_timeout = 31536000
character-set-server  =utf8mb4
collation-server  = utf8mb4_general_ci
init_connect  = 'SET NAMES utf8mb4'
lower_case_table_names = 1
log_error  = /data/mysql-5.6.35/log/error.log
slow_query_log = 1
slow_query_log_file = /data/mysql-5.6.35/log/slow.log

[mysqld_safe]
err-log= /data/mysql-5.6.35/log/mysqld_safe_err.log
pid-file = /data/mysql-5.6.35/var/mysqld.pid

将服务脚本复制到/etc/init.d目录下,并添加到服务列表

sudo cp  support-files/mysql.server  /etc/init.d/mysqld

开机自启动

sudo chkconfig --add mysqld
sudo chkconfig mysqld on
sudo chkconfig --list mysqld

启动mysql

sudo  /etc/init.d/mysqld start
ps –ef | grepmysql

设置mysql密码

sudo /data/mysql-5.6.35/bin/mysqladmin -u root password 'newpassword'

登录

mysql  -uroot   -p

配置安全策略:

[root@KVM mysql-5.6.35]#sudo /data/mysql-5.6.35/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL      
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
      
      
      In order to log into MySQL to secure it, we'll need the currentpassword for the root user.  Ifyou've just installed MySQL, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.
      
      Enter current password for root (enter for none):OK, successfully used password, moving on...
      
      Setting the root password ensures that nobody can log into the MySQLroot user without the proper authorisation.
      You already have a root password set, so you can safely answer 'n'.
      Change the root password? [Y/n] n 
      ... skipping.
      
      By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem.  This is intended only fortesting, and to make the installationgo a bit smoother.  You shouldremove them before moving into aproduction environment.
      
      Remove anonymous users? [Y/n] y 
      ... Success!
      
      Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network.
      Disallow root login remotely? [Y/n] n 
      ... Success!
      
      By default, MySQL comes with a database named 'test' that anyone canaccess.  This is also intended only fortesting, and should be removedbefore moving into a production environment.
      Remove test database and access to it? [Y/n] y 
       - Dropping test database... 
       ... Success! 
       - Removing privileges on testdatabase... 
       ... Success!
      
      Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.
      
      Reload privilege tables now? [Y/n] y 
      ... Success!
      
      All done!  If you've completed allof the above steps, your MySQLinstallation should now be secure.
      Thanks for using MySQL!
      
      Cleaning up...
      [root@KVM mysql-5.6.35]#

二进制快速安装mysql5.6.35的步骤就先给大家讲到这里,对于其它相关问题大家想要了解的可以持续关注我们的行业资讯。我们的板块内容每天都会捕捉一些行业新闻及专业知识分享给大家的。

相关内容

热门资讯

2000万粉丝博主发声:撑不住... 5月14日、15日两天,辽宁本地知名搞笑博主“大连老湿王博文”,分别在微信公众号和小红书上发表长文,...
零食包装也变黑白,死亡氛围在日... 作者 | 荣智慧 编辑 | 向现5月12日,日本“国民零食”巨头卡乐比宣布,因“石脑油”供应短缺,旗...
欧洲首个可复用航天器整装待发,... (来源:科普中国) 转自:科普中国 据阿根廷布宜诺斯艾利斯经济新闻网 5 月 10 日报道,欧洲即将...
奥立电子取得密封型线束专利,降... 国家知识产权局信息显示,东莞奥立电子有限公司取得一项名为“密封型线束”的专利,授权公告号CN2242...
嘉陵江重庆段发生划桨板人员落水... 记者从重庆市相关部门了解到,16日晚,嘉陵江重庆中心城区段发生一起划桨板人员落水事件,有7人落水。事...
自动空调调到多少度合适 冬天,调成30度比较合适的。夏天的时候,空调设置的温度应该比室外温度低3到4度,一般来说,26度是比...
空调制热多少度合适 空调制热多少度合适?从人体舒适方面来考虑,冬季室内温度最好控制在18—20度之间。在这个温度下人是感...
电视机运行内存多大合适 电视机运行内存多大合适:4k电视的运行内存在2GB及以上最好。如今,Android 5.0以上的系统...
iphone13电量 演示机型信息: 品牌型号:iPhone13 系统版本:IOS16.1 iphone13电量最高百分之...
noritz能率热水器维修电话 热水器在我们的日常生活中扮演着重要的角色,为我们提供温暖舒适的热水。然而,由于长时间使用或其他原因,...