标签:
[root@localhost Desktop]$ rpm -qa | grep mysql mysql-libs-5.1.52-1.el6_0.1.x86_64 [root@localhost ~]# rpm -e mysql-libs-5.1.52.x86_64 --nodeps [root@localhost ~]#
3.创建mysql用户及组
[root@localhost ~]#groupadd mysql
[root@localhost ~]#useradd -r -g mysql mysql
之后可以查看一下成功创建没
[root@localhost ~]# cat /etc/group | grep mysql
[root@localhost ~]# cat /etc/passwd | grep mysql4.
[root@promote local]# tar -zxvf mysql-5.7.15-linux-glibc2.5-i686.tar.gz
5. 解压成功后将文件改个名字
[root@promote local]# mv mysql-5.7.15-linux-glibc2.5-i686 mysql
6.安装和初始化数据库
[root@promote local]# mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
[root@promote local]# cd mysql
[root@promote local]#
[root@promote mysql]#cp -a ./support-files/my-default.cnf /etc/my.cnf
问你是否覆盖时,yes
[root@promote local]#cp -a ./support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql]# cd bin/
[root@localhost bin]# ./mysqld_safe --user=mysql &
[1] 1986
[root@promote bin]# 2016-10-05T16:34:17.548875Z mysqld_safe Logging to ‘/usr/local/mysql/data/promote.cache-dns.local.err‘.
2016-10-05T16:34:17.629041Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@promote bin]# /etc/init.d/mysqld restart Shutting down MySQL..2016-10-05T16:35:37.679390Z mysqld_safe mysqld from pid file /usr/local/mysql/data/promote.cache-dns.local.pid ended [ OK ] Starting MySQL. [ OK ] [1]+ Done ./mysqld_safe --user=mysql [root@promote bin]#
设置开机启动mysql
[root@localhost bin]# chkconfig --level 35 mysqld on
[root@localhost bin]# cat /root/.mysql_secret
# Password set for user ‘root@localhost‘ at 2016-10-06 00:29:51
Lfu+t9hi+ojn
[root@promote bin]# ./mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.15
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
修改密码
mysql> SET PASSWORD = PASSWORD(‘123456‘); Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
8.添加远程访问权限
mysql> use mysql; mysql> update user set host = ‘%‘ where user = ‘root‘; mysql>quit [root@promote bin]# /etc/init.d/mysqld restart
9.开放端口3306(也可以用其他端口)
[root@localhost bin]#/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT;
[root@localhost bin]#/etc/init.d/iptables status
[root@localhost bin]#/etc/rc.d/init.d/iptables save
标签:
原文地址:http://www.cnblogs.com/zhazhenyu1992/p/5932498.html