Ⅰ 如何利用sourceforge的免费空间免费数据库建站
步骤:
1、创建一个SourceForge账号并登录
传送门在这里。
2、创建一个项目
右上角 Me → Profile → Create a Project
project name,如firstlog,URL Name,如firstlog,于是你得到一个项目的地址:
http://sourceforge.net/p/firstlog
3、修改项目属性
登录https://sourceforge.net/p/firstlog,左侧有下面几个标签,
Metadata Screenshots Categorization Tools User Permissions Audit Trail
我们重点用到的是Tools。点击进去~
4、配置mysql数据库
在Tools中找到MySQL Databases并点击进行安装。
安装后到页面最下端找到MySQL,点击Admin MySQL Databases,进入配置数据库阶段。
在配置页面中的Setting部分,可以看到只读、读写、管理员账户的用户名以及mysql的地址https://mysql-f.sourceforge.net,在下面的Password部分需要设置三个账户的密码。
打开https://mysql-f.sourceforge.net,并输入用户名以及上面设置的密码,即可通过网页管理数据库。
5、配置svn
同mysql配置。
6、配置git
同mysql配置。
7、配置域名
同样在Tools下安装VHOST,在页面下方找到VHOST,点击Set Project Web vhosts,进入后将你的新域名,如“www.firstlog.net"填到New virtual host中并Create。然后在你的域名服务商那里,我的是万网,在域名解析里增加CNAME值为vhost.sourceforge.net。大概需要等一个多小时,新域名生效。
8、配置文件传输
打开WinSCP,协议名SFTP,主机名web.sourceforge.net,用户名为"你的sf账户用户名,项目名",如"bbdlg,firstlog",密码为你的sf密码。
9、hello world~
写如下内容到 index.php 中,
?
1
2
3
<?php
echo "hallo world!";
?>
上传index.php到htdocs中,在浏览器中输入 www.firstlog.net 即可看到我们的hallo world了。
Ⅱ centos怎么安装mysql
当前位置: > CentOS服务器 > 数据库服务器 > MySQL >
centos6.5下安装mysql
时间:2014-08-12 01:11来源:blog.csdn.net 作者:brushli 举报 点击:17509次
1.使用yum命令安装mysql
[html] view plain
[root@bogon ~]# yum -y install mysql-server
2.设置开机启动
[html] view plain
[root@bogon ~]# chkconfig mysqld on
3.启动MySQL服务
[html] view plain
[root@bogon ~]# service mysqld start
4.设置MySQL的root用户设置密码
[html] view plain
[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)
查询用户的密码,都为空,用下面的命令设置root的密码为root
[html] view plain
mysql> set password for root@localhost=password('root');
mysql> exit
5.用新密码登陆
[html] view plain
[root@bogon ~]# mysql -u root -p
Enter password:
6.创建mysql新用户test_user
[html] view plain
mysql> create user 'test_user'@'%' identified by 'test_user';
Query OK, 0 rows affected (0.00 sec)
7.给新用户test_user授权,让他可以从外部登陆和本地登陆
注意:@左边是用户名,右边是域名、IP和%,表示可以访问mysql的域名和IP,%表示外部任何地址都能访问。
[html] view plain
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 | * |
| root | bogon | |
| root | 127.0.0.1 | |
| | localhost | |
| | bogon | |
| test_user | % | * |
| test_user | localhost | * |
+----------+-----------+-------------------------------------------+
7 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
8.查看mysql5.1的默认存储引擎
从下面的执行结果可以看出,mysql的默认引擎是MyISAM,这个引擎是不支持事务的。
[html] view plain
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)
也可以以下面的方式查看
[html] view plain
mysql> show variables like 'storage_engine';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | MyISAM |
+----------------+--------+
1 row in set (0.00 sec)
9.修改mysql的默认引擎为InnoDB
9.1 停止mysql
[html] view plain
mysql> exit;
[root@bogon ~]# service mysqld stop
9.2 修改/etc/my.cnf
[mysqld] 后加入
[html] view plain
default-storage-engine=InnoDB
加入后my.cnf的内容为:
[html] view plain
[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.3 启动mysql
[html] view plain
[root@bogon etc]# service mysqld start
Starting mysqld: [ OK ]
9.4 查看mysql默认存储引擎
[html] view plain
[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)
10.CentOS6.5开放mysql端口3306
CentOS6.5默认是不开放端口的,如果要让外部的系统访问CentOS6.5上的mysql,必须开放mysql的端口3306
10.1 修改/etc/sysconfig/iptables
添加下面一行
[html] view plain
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
修改后iptables中的内容是
[html] view plain
[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
11.重启防火墙
[html] view plain
[root@bogon etc]# service iptables restart
这样就可以从外部访问mysql了。
至此,mysql在CentOS6.5上的安装过程、用户创建、外部访问的步骤全部完成。
Ⅲ SQL Server选择题求助
B
B
D
B
A
D
B
C
A
A
B
C
D
Ⅳ 多线程 连接数据库,C#多线程写数据库
多线程连接数据库的连接池类:
public static class ConnectionPool
{
private static object locker = new object();
private static Dictionary<string, SqlConnection> Connections = null;
public static SqlConnection GetConnection<T>() where T : class, new()
{
string databaseName = NA.Common.Extensions.GetDatabaseName<T>();
if (string.IsNullOrEmpty(databaseName))
return null;
if (Connections == null)
{
lock (locker)
{
Connections = new Dictionary<string, SqlConnection>();
}
}
string connKey = FindFreeSqlConnection(databaseName);
if (connKey != null)
return Connections[connKey];
else
{
string strconn = NA.Common.Extensions.GetConnectionString<T>();
int poolSize = NA.Common.Extensions.GetConnectionPoolSize<T>();
lock (locker)
{
for (int i = 0; i < poolSize; ++i)
{
SqlConnection conn = new SqlConnection(strconn);
conn.Open();
Connections.Add(databaseName + "_" + i.ToString(), conn);
conn.Close();
}
}
return Connections[FindFreeSqlConnection(databaseName)];
}
}
private static string FindFreeSqlConnection(string databaseName)
{
IEnumerable<string> connKeys = Connections.Keys.Where(item => item.StartsWith(databaseName));
if (connKeys != null && connKeys.Count() > 0)
{
foreach (string key in connKeys)
{
if (Connections[key].State == ConnectionState.Closed)
return key;
}
}
return null;
}
}
附加上其中用到的三个方法:
internal static int GetConnectionPoolSize<T>() where T : class, new()
{
string database = GetDatabaseName<T>();
string[] poolSizeArray = ConfigurationManager.AppSettings["ConnectionsPoolSize"].Split('|');
if (poolSizeArray != null)
{
foreach (string sizeItem in poolSizeArray)
{
string[] sizeItemArray = sizeItem.Split(':');
if (database == sizeItemArray[0])
return int.Parse(sizeItemArray[1]);
}
}
return 50;
}
public static string GetConnectionString<T>() where T : class, new()
{
string tableName = GetTableName<T>();
string[] databaseArray = ConfigurationManager.AppSettings["DatabaseArray"].Split('|');
if (databaseArray != null)
{
foreach (string database in databaseArray)
{
string tableNameList = ConfigurationManager.AppSettings[database];
string[] tables = ConfigurationManager.AppSettings[database].Split('|');
if (tables != null && tables.Length > 0)
if (tables.Contains(tableName))
return ConfigurationManager.ConnectionStrings[database].ConnectionString;
}
}
return string.Empty;
}
public static string GetDatabaseName<T>() where T : class, new()
{
string tableName = GetTableName<T>();
string[] databaseArray = ConfigurationManager.AppSettings["DatabaseArray"].Split('|');
if (databaseArray != null)
{
foreach (string database in databaseArray)
{
string tableNameList = ConfigurationManager.AppSettings[database];
string[] tables = ConfigurationManager.AppSettings[database].Split('|');
if (tables != null && tables.Length > 0)
if (tables.Contains(tableName))
return database;
}
}
return string.Empty;
}
Ⅳ 数据库题目
所有题目:DACBBD
有问题再追问,望采纳。
Ⅵ 字段太小而不能接受所要添加的数据的数量
设置为备注型字段。
Ⅶ 什么是BBD / 网络技术编程
网络编程从大的方面说就是对信息的发送到接收,中间传输为物理线路的作用。
网络编程最主要的工作就是在发送端把信息通过规定好的协议进行组装包,在接收端按照规定好的协议把包进行解析,从而提取出对应的信息,达到通信的目的。中间最主要的就是数据包的组装,数据包的过滤,数据包的捕获,数据包的分析,当然最后再做一些处理,代码、开发工具、数据库、服务器架设和网页设计这5部分你都要接触。
Ⅷ 数据库的问题
DCBDC ACAAC BBDCD