创建Mysql表

时间:2019-05-02 17:43:44

标签: mysql

我下载了要安装在VPS上的脚本,并且正如创建该脚本的创建者在说明中所述,我仅将名为sql.sgl的文件导入创建数据库的根文件夹中,但是之后我无法运行该脚本,并且正如我在MySql中看到的那样,没有创建任何表,所以我想知道是否有可能通过mysql中的命令从sql.sql文件创建所有内容,如果有人可以告诉我什么命令在Linux中,我使用以下代码手动创建所有表,其余的则从文件中创建:

无论如何,我只是检查了error.log文件,并且该错误在此脚本行9上,请帮助,此代码可以吗?

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_saha = "111.111.111.135";
$database_saha = "search";
$username_saha = "root";
$password_saha = "me111";
$saha = mysqli_connect($hostname_saha, $username_saha, $password_saha, $database_saha) or trigger_error(mysqli_error($saha),E_USER_ERROR); 

mysqli_set_charset( $saha, 'utf8');

?>
-- version 4.6.0
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Dec 04, 2016 at 12:02 PM
-- Server version: 5.5.52-cll-lve
-- PHP Version: 5.6.14

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `hello`
--

-- --------------------------------------------------------

--
-- Table structure for table `admin`
--

CREATE TABLE `admin` (
  `id` int(11) NOT NULL,
  `un` varchar(30) NOT NULL,
  `pw` varchar(30) NOT NULL,
  `demo` enum('Y','N') NOT NULL DEFAULT 'Y',
  `max_pages` int(11) DEFAULT '20',
  `max_content` int(11) DEFAULT '500'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`id`, `un`, `pw`, `demo`, `max_pages`, `max_content`) VALUES
(1, 'administrator', 'admin', 'N', 20, 500);

-- --------------------------------------------------------

--
-- Table structure for table `crawl`
--

CREATE TABLE `crawl` (
  `id` int(11) NOT NULL,
  `base_url` varchar(1000) NOT NULL,
  `actual_url` varchar(2000) NOT NULL,
  `title` varchar(2500) NOT NULL,
  `description` varbinary(200) DEFAULT NULL,
  `keywords` varbinary(200) DEFAULT NULL,
  `content` varchar(500) DEFAULT NULL,
  `current_url` varchar(2000) NOT NULL,
  `last_update` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted` enum('Y','N') DEFAULT 'N',
  `block_update` enum('Y','N') DEFAULT 'N',
  `visits` int(11) DEFAULT '0',
  `manual` enum('Y','N') DEFAULT 'N'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` int(11) NOT NULL,
  `base_url` varchar(1000) NOT NULL,
  `actual_url` varchar(2000) NOT NULL,
  `demo` enum('Y','N') DEFAULT 'N',
  `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `un` (`un`),
  ADD UNIQUE KEY `un_2` (`un`);

--
-- Indexes for table `crawl`
--
ALTER TABLE `crawl`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT for table `crawl`
--
ALTER TABLE `crawl`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=747;
--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;```

0 个答案:

没有答案