简体   繁体   中英

Msg 5123, Level 16, State 1, Line 8 The CREATE FILE statement encountered operating system error 2 (The system cannot find the specified file.)

I'm new using the tool of azure data studio, and when trying to create a database I skip the following error.

Msg 5123, Level 16, State 1, Line 8 The CREATE FILE statement encountered operating system error 2 (The system cannot find the specified file.)

I was wondering if anyone knew of any solutions. By the way I work on a machine with Kubuntu 19.10 in case it has something to do with it.

I use this code to create the database:

-- Create a new database called 'DATA_1'
-- Connect to the 'master' database to run this snippet
USE master
GO
-- Create the new database if it does not exist already
IF NOT EXISTS (
    SELECT [name]
        FROM sys.databases
        WHERE [name] = N'DATA_1'
)
CREATE DATABASE DATA_1
GO

Solved, the problem was that you had to make a sudo mssql chgrp and the path of the folder where the mdf and ldf are saved

https://docs.microsoft.com/es-es/sql/linux/sql-server-linux-configure-mssql-conf?view=sql-server-ver15#change-the-default-data-or-log-directory-location

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM