秦皇岛 网站建设,怎么做淘客推广网站,河南省专业做网站公司,网络外包运营公司最开始用服务器的时候#xff0c;也是对这些环境的安装操作极其陌生#xff0c;找了很多方式#xff0c;写这边文章就是为了让更少的童鞋走弯路#xff0c;下面我们看看具体的操作流程。1、首先关闭linux的防火墙#xff0c;执行命令chkconfig iptables off2、从mysql官网…最开始用服务器的时候也是对这些环境的安装操作极其陌生找了很多方式写这边文章就是为了让更少的童鞋走弯路下面我们看看具体的操作流程。1、首先关闭linux的防火墙执行命令chkconfig iptables off2、从mysql官网上下载自己适合的mysql版本https://dev.mysql.com/downloads/mysql/5.6.html#downloads进入mysql官网依次点击3、下载后的mysql文件mysql-5.6.40-linux-glibc2.12-i686.tar.gz 将下载好的mysql压缩文件放置在linux的/usr/local文件夹下解压该压缩文件tar -zxvf mysql-5.6.40-linux-glibc2.12-i686.tar.gz将解压后的文件重命名为mysqlmv mysql-5.6.40-linux-glibc2.12-i686 mysql4、创建mysql用户组及用户groupadd mysqluseradd -r -g mysql mysql5、进入到mysql目录执行添加MySQL配置的操作cp support-files/my-medium.cnf /etc/my.cnf 或 cp support-files/my-default.cnf /etc/my.cnf是否覆盖按y 回车6、编辑/etc/my.cnf文件vi /etc/my.cnf在my.cnf文件中添加或者修改相关配置更改完成后保存退出1# For advice on how to change settings please see 2# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html 3# *** DO NOT EDIT THIS FILE. Its a template which will be copied to the 4# *** default location during install, and will be replaced if you 5# *** upgrade to a newer version of MySQL. 6 7[mysqld] 8 9# Remove leading # and set to the amount of RAM for the most important data10# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.11# innodb_buffer_pool_size 128M1213# Remove leading # to turn on a very important data integrity option: logging14# changes to the binary log between backups.15# log_bin1617# These are commonly set, remove the # and set as required.18basedir /usr/local/mysql19datadir /usr/local/mysql/data20port 330621# server_id .....22socket /tmp/mysql.sock23character-set-server utf824skip-name-resolve25log-err /usr/local/mysql/data/error.log26pid-file /usr/local/mysql/data/mysql.pid2728# Remove leading # to set options mainly useful for reporting servers.29# The server defaults are faster for transactions and fast SELECTs.30# Adjust sizes as needed, experiment to find the optimal values.31# join_buffer_size 128M32# sort_buffer_size 2M33# read_rnd_buffer_size 2M 3435sql_modeNO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES7、在mysql当前目录下设定目录的访问权限注意后面的小点表示当前目录chown -R mysql .chgrp -R mysql .scripts/mysql_install_db --usermysqlchown -R root .chown -R mysql data8、初始化数据在mysql/bin或者mysql/scripts下有个 mysql_install_db 可执行文件初始化数据库进入mysql/bin或者mysql/scripts目录下执行下面命令./mysql_install_db --verbose --userroot --defaults-file/etc/my.cnf --datadir/usr/local/mysql/data --basedir/usr/local/mysql --pid-file/usr/local/mysql/data/mysql.pid --tmpdir/tmp9、启动mysql进入/usr/local/mysql/bin目录执行下面命令./mysqld_safe --defaults-file/etc/my.cnf --socket/tmp/mysql.sock --userroot 注意如果光标停留在屏幕上表示启动成功需要我们先关闭shell终端再开启一个新的shell终端不要执行退出操作。如果出现 mysql ended这样的语句表示Mysql没有正常启动你可以到log中查找问题.10、设置开机启动新开启shell中断后进入mysql目录执行下面命令cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqldcp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqlchmod 700 /etc/init.d/mysqlchkconfig --add mysqldchkconfig --level 2345 mysqld onchown mysql:mysql -R /usr/local/mysql/重启linuxreboot查看mysql状态service mysqld status11、添加远程访问权限 1、添加mysql命令ln -s /usr/local/mysql/bin/mysql /usr/bin mysql的安装路径 2、更改访问权限登录mysql,执行下面命令mysql -uroot -p 密码为空直接回车,运行以下两条命令GRANT ALL PRIVILEGES ON *.* TO root% IDENTIFIED BY duan with grant option;Flush privileges;退出mysqlexit重启linux,就完成了reboot注本机访问mysqlroot账户默认是没有密码的端口号默认3306如果需要修改root账户密码在/usr/local/mysql/bin目录下执行下面命令./mysqladmin -h 127.0.0.1 -P3306 -uroot password duanexit