标签:form sql命令 软连接 iba sof let end 数据库 line
博主最近在研究mysql的读写分离和主从复制,一台master和两台slave,三台机器在同一个局域网中,首先就就要在centos6.5中安装mysql5.7。好了,废话不多说,接下来进入正题。
[root@localhost local]# cd /usr/local/soft/ [root@localhost soft]# tar zvxf mysql-5.7.10-linux-glibc2.5-i686.tar.gz -C /usr/local [root@localhost soft]# cd .. [root@localhost local]# mv mysql-5.7.10-linux-glibc2.5-i686/ mysql
[root@localhost local]# mkdir mysql/data
[root@localhost local]# groupadd mysql [root@localhost local]# useradd mysql -g mysql [root@localhost local]# cd mysql [root@localhost mysql]# pwd /usr/local/mysql [root@localhost mysql]# chown -R mysql . #给名称为mysql的用户授权 [root@localhost mysql]# chgrp -R mysql .
[root@localhost mysql]# cd /usr/local/mysql/bin [root@localhost bin]# yum install libaio [root@localhost bin]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data 2016-01-09 12:00:28 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize 2016-01-09 12:00:33 [WARNING] The bootstrap log isn‘t empty: 2016-01-09 12:00:33 [WARNING] 2016-01-09T04:00:29.262989Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead 2016-01-09T04:00:29.264643Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000) 2016-01-09T04:00:29.264653Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000) [root@localhost bin]# cd /usr/local/mysql/support-files [root@localhost support-files]# ./mysql.server start Starting MySQL. SUCCESS!
[root@localhost ~]# cat /root/.mysql_secret # Password set for user ‘root@localhost‘ at 2016-11-10 20:19:35 2t:tRP01UZ16 #利用初始化密码:2t:tRP01UZ16 开始登录mysql: [root@localhost ~]# cd /usr/local/mysql/bin [root@localhost bin]# ./mysql -uroot -p:2t:tRP01UZ16 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.7.10 Copyright (c) 2000, 2015, 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>
显示登录成功,可以执行mysql命令操作了!
mysql> set password=password(‘admin‘); Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select Host,User from user; +-----------+-----------+ | Host | User | +-----------+-----------+ | % | root | | localhost | mysql.sys | | localhost | root | +-----------+-----------+ 3 rows in set (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO root@‘%‘ identified by ‘admin‘; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
授权语句最后的‘admin’是mysql数据库root用户的新密码。
[root@localhost mysql]# service iptables stop setenforce 0iptables:将链设置为政策 ACCEPT:filter [确定] iptables:清除防火墙规则: [确定] iptables:正在卸载模块: [确定] [root@localhost mysql]# setenforce 0 setenforce: SELinux is disabled
[root@localhost mysql]# cd /usr/local/mysql/support-files/ [root@localhost support-files]# cp mysql.server /etc/init.d [root@localhost support-files]# cd /etc/init.d [root@localhost init.d]# mv mysql.server mysqld [root@localhost init.d]# cd /usr/bin [root@jacky bin]# ln -s /usr/local/mysql/bin/mysql mysql
注意问题:存放mysql解压文件路径/usr/local/mysql和存放mysql数据路径/usrl/local/mysql/data ,博主刚开始以为这个路径是自定义的,就命名为/usr/local/mysql5.7和/usrl/local/mysql5.7/data结果没安装成功了,但是启动不了,最后只能卸载了重新安装
标签:form sql命令 软连接 iba sof let end 数据库 line
原文地址:http://www.cnblogs.com/520playboy/p/6052495.html