建站笔记1:centos6.5下安装mysql
近期买了个域名,想要玩玩自己建站点:接下来遇到的问题都会一次记录下来。以备自己以后复习查看:
首先建站方案选择: wordPress +centos6.5 +mysql;
server买的:搬瓦工最低配置,事实上主要用来使用vpn。(你懂的,感兴趣的能够翻看我曾经的博客)。
地址:https://bandwagonhost.com
wordpress 下载地址:https://cn.wordpress.org
域名是百度开放云买的。推荐,非常优惠啊!
第一个问题:centos6.5下安装mysql: 參考链接:http://www.centoscn.com/mysql/2014/0812/3481.html
1.使用yum命令安装mysql2.设置开机启动[html] view plaincopy![]()
- [root@bogon ~]# yum -y install mysql-server
3.启动MySQL服务[html] view plaincopy![]()
- [root@bogon ~]# chkconfig mysqld on
4.设置MySQL的root用户设置密码[html] view plaincopy![]()
- [root@bogon ~]# service mysqld start
查询用户的密码,都为空。用以下的命令设置root的密码为root[html] view plaincopy![]()
- [root@bogon ~]# mysql -u root
- mysql> select user,host,password from mysql.user;
- +------+-----------+----------+
- | user | host | password |
- +------+-----------+----------+
- | root | localhost | |
- | root | bogon | |
- | root | 127.0.0.1 | |
- | | localhost | |
- | | bogon | |
- +------+-----------+----------+
- 5 rows in set (0.01 sec)
5.用新密码登陆[html] view plaincopy![]()
- mysql> set password for root@localhost=password('root');
- mysql> exit
6.创建mysql新用户test_user[html] view plaincopy![]()
- [root@bogon ~]# mysql -u root -p
- Enter password:
7.给新用户test_user授权,让他能够从外部登陆和本地登陆[html] view plaincopy![]()
- mysql> create user 'test_user'@'%' identified by 'test_user';
- Query OK, 0 rows affected (0.00 sec)
注意:@左边是username,右边是域名、IP和%。表示能够訪问mysql的域名和IP,%表示外部不论什么地址都能訪问。8.查看mysql5.1的默认存储引擎[html] view plaincopy![]()
- mysql> grant all privileges on *.* to 'test_user'@'localhost' identified by 'test_user';
- Query OK, 0 rows affected (0.00 sec)
- mysql> grant all privileges on *.* to 'test_user'@'%' identified by 'test_user';
- Query OK, 0 rows affected (0.00 sec)
- mysql> select user,host,password from mysql.user;
- +----------+-----------+-------------------------------------------+
- | user | host | password |
- +----------+-----------+-------------------------------------------+
- | root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
- | root | bogon | |
- | root | 127.0.0.1 | |
- | | localhost | |
- | | bogon | |
- | test_user | % | *3046CF87132BBD4FDDF06F321C6859074843B7D3 |
- | test_user | localhost | *3046CF87132BBD4FDDF06F321C6859074843B7D3 |
- +----------+-----------+-------------------------------------------+
- 7 rows in set (0.00 sec)
- mysql> flush privileges;
- Query OK, 0 rows affected (0.01 sec)
从以下的运行结果能够看出,mysql的默认引擎是MyISAM。这个引擎是不支持事务的。也能够以以下的方式查看[html] view plaincopy![]()
- mysql> show engines;
- +------------+---------+------------------------------------------------------------+--------------+------+------------+
- | Engine | Support | Comment | Transactions | XA | Savepoints |
- +------------+---------+------------------------------------------------------------+--------------+------+------------+
- | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
- | CSV | YES | CSV storage engine | NO | NO | NO |
- | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
- | InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
- | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
- +------------+---------+------------------------------------------------------------+--------------+------+------------+
- 5 rows in set (0.00 sec)
9.改动mysql的默认引擎为InnoDB[html] view plaincopy![]()
- mysql> show variables like 'storage_engine';
- +----------------+--------+
- | Variable_name | Value |
- +----------------+--------+
- | storage_engine | MyISAM |
- +----------------+--------+
- 1 row in set (0.00 sec)
9.1 停止mysql9.2 改动/etc/my.cnf[html] view plaincopy![]()
- mysql> exit;
- [root@bogon ~]# service mysqld stop
[mysqld] 后加入加入后my.cnf的内容为:[html] view plaincopy![]()
- default-storage-engine=InnoDB
9.3 启动mysql[html] view plaincopy![]()
- [root@bogon etc]# more my.cnf
- [mysqld]
- datadir=/var/lib/mysql
- socket=/var/lib/mysql/mysql.sock
- user=mysql
- # Disabling symbolic-links is recommended to prevent assorted security risks
- symbolic-links=0
- default-storage-engine=InnoDB
- [mysqld_safe]
- log-error=/var/log/mysqld.log
- pid-file=/var/run/mysqld/mysqld.pid
9.4 查看mysql默认存储引擎[html] view plaincopy![]()
- [root@bogon etc]# service mysqld start
- Starting mysqld: [ OK ]
10.CentOS6.5开放mysql端口3306[html] view plaincopy![]()
- [root@bogon etc]# mysql -u root -p
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 2
- Server version: 5.1.73 Source distribution
- Copyright (c) 2000, 2013, 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> show variables like 'storage_engine';
- +----------------+--------+
- | Variable_name | Value |
- +----------------+--------+
- | storage_engine | InnoDB |
- +----------------+--------+
- 1 row in set (0.00 sec)
CentOS6.5默认是不开放端口的。假设要让外部的系统訪问CentOS6.5上的mysql,必须开放mysql的端口3306
10.1 改动/etc/sysconfig/iptables
加入以下一行改动后iptables中的内容是[html] view plaincopy![]()
- -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
11.重新启动防火墙[html] view plaincopy![]()
- [root@bogon etc]# more /etc/sysconfig/iptables
- # Firewall configuration written by system-config-firewall
- # Manual customization of this file is not recommended.
- *filter
- :INPUT ACCEPT [0:0]
- :FORWARD ACCEPT [0:0]
- :OUTPUT ACCEPT [0:0]
- -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
- -A INPUT -p icmp -j ACCEPT
- -A INPUT -i lo -j ACCEPT
- -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
- #加入配置项
- -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
- -A INPUT -m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT
- -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
- -A INPUT -j REJECT --reject-with icmp-host-prohibited
- -A FORWARD -j REJECT --reject-with icmp-host-prohibited
- COMMIT
[html] view plaincopy![]()
- [root@bogon etc]# service iptables restart
建站笔记1:centos6.5下安装mysql的更多相关文章
- centos6.5下安装mysql数据库
centos6.5下安装mysql数据库 1.安装mysql数据库:yum install mysql-server 2.临时启动数据库:service mysqld start 3.开机启动数据库: ...
- centos6.4下安装mysql
一.mysql简介 说到数据库,我们大多想到的是关系型数据库,比如mysql.oracle.sqlserver等等,这些数据库软件在windows上安装都非常的方便,在Linux上如果要安装数据库,咱 ...
- centos6.5下安装mysql
http://www.centoscn.com/mysql/2014/0812/3481.html 1.使用yum命令安装mysql [root@bogon ~]# yum -y install m ...
- CentOS6.8下安装mysql
转自https://blog.csdn.net/jeffleo/article/details/53559712?utm_source=itdadao&utm_medium=referral ...
- CentOS6.7下安装MySQL
第一步:到MySQL官网上下载linux版本的MySQL rpm 安装包. 第二步: 将该压塑包解压后,有如下文件: 第三步:安装文件,我们需要安装的文件有 MySQL-server-5.6.26-1 ...
- linux centos6.8 下安装mysql 步骤
安装环境:vmware12.centos6.8.centos中配置阿里云数据元 1.下载mysql 运行: sudo yum -y install mysql-server 如果下载失败,可以卸载重新 ...
- 【转载】CentOS6.5_X64下安装配置MongoDB数据库
[转载]CentOS6.5_X64下安装配置MongoDB数据库 2014-05-16 10:07:09| 分类: 默认分类|举报|字号 订阅 下载LOFTER客户端 本文转载自zhm&l ...
- centos 6.5下安装mysql+nginx+redmine 3.1.0 笔记
centos 6.5下安装mysql+nginx+redmine 3.1.0 笔记 目录[-] 过程 1.安装RVM 2.利用rvm安装 Ruby 1.9.3 并设为默认 3.安装rails 4.安装 ...
- CentOS6.5下安装apache2.2和PHP 5.5.28
CentOS6.5下安装apache2.2 1. 准备程序 :httpd-2.2.27.tar.gz 下载地址:http://httpd.apache.org/download.cgi#apache2 ...
随机推荐
- XSL
前言 XSL,拓展样式表语言,可以理解为XML用的CSS,在其中定义xml格式对应的东西 放在xsl文件中 XSLT,按照XSL中的格式将XML转为XHTML 语法 XML声明: <?xml v ...
- spark启动问题,发现任务都是在localhost下面运行的,原来启动spark-shell的时候需要带主节点的参数
在Spark 集群上运行一个应用,只需通过master的 spark://IP:PORT 链接传递到SparkContext构造器 在集群上运行交互式的Spark 命令, 运行如下命令: MASTER ...
- AndroidManifest.xml文件详解(uses-permission)
语法(SYNTAX): <uses-permissionandroid:name="string"/> 被包含于(CONTAINED IN): <manifest ...
- ReentrantLock和ReentrantReadWriteLock对比
本文系作者原创,转载请注明:https://www.cnblogs.com/yanfei1819/p/10314533.html ReentrantLock 一.简介 ReentrantLock重入锁 ...
- CNN的发展
模型的建立过程: 1959年,Hubel & Wiesel发现动物视觉皮层中的细胞负责检测感受野(receptive fields)中的光线.论文:Receptive fields and f ...
- Ubantu配置protoc2.5.0
首先得到 protobuf 相应的包文件 ,在终端上输入如下 wget http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz 下载完毕后 ...
- Java字符串格式化输入({0}/%s)
用法: System.out.println(MessageFormat.format("{0}{1}",1,2)); System.out.println(String.form ...
- VITAM POST MORTEM – ANALYZING DEADLOCKED SCHEDULERS MINI DUMP FROM SQL SERVER
https://gennadny.wordpress.com/2014/11/ Since SQL Server 7.0, SQL Server has its own scheduling mech ...
- winform listview默认第一项光标选中
if (this.lsvSortingHeadList.Items.Count > 0) { this.lsvSortingHeadList.Focus(); this.lsvSortingHe ...
- 万里长征第二步——django个人博客(第六步 ——添加富文本编辑器)
下载kindeditor 在admin.py文件中配置链接 class Media: js = ( '/static/js/kindeditor-4.1.10/kindeditor-min.js', ...
