解决SQL Server创建数据库报错 Create failed for Database Error 5133

本篇讲讲解如果解决在SQL Server下创建数据库报错:

Create failed for Database ‘TestDB’. (Microsoft.SqlServer.Smo)

Additional information:

An exception occurred while executing a Transact-SQL statement or batch.

(Microsoft.SqlServer.ConnectionInfo)

Directory lookup for the file “G:Program FilesMicrosoft SQL ServerMSSQL11.MSSQLSERVERMSSQLDATATestDB_log.ldf” failed with the operating system error 3 (The system cannot find the path specified).

CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

(Microsoft SQL Server, Error 5133)

sql-error-5133

我在这个测试里尝试去创建数据库TestDB。遇到这种报错信息的时候,你需要检查需要创建的数据库的路径。

正常情况下,当你创建数据库时,如果没有另外添加,SQL Server会自动创建一个Rows Data和一个log,你需要检查两个数据库文件的路径是否合法。

如果将路径改为一个合法路径,你的数据库将会被创建。