Linear Regression Error
Your code has two typos:

1. Error when selecting data for the target variables. 

In the second line, you are using [:, :-1] which means that you select all rows, and all columns except the last one.

In the third line, you are using [:, 1] which means that you select all rows, and only the first column instead of the last.
Instead, you want to select the columns of your target variable, i.e. the last one:

y=dataset.iloc[:, -1]


2. Error when fitting the model

You are fitting your model using the X training set and the Y validation set. They have different length. Use this instead:

regressor.fit(x_train, y_train)