I get the error "Table 'mysql.servers' doesn't exist" from plesk when I try to create a new database user, the created user does not show up anywhere but the name is still reserved, and it does not allow me to access the database.
edit:
I was unable to login to phpMyAdmin to this webserver, so instead I managed to login to it through a different domain, and it tells me a notice: Your PHP MySQL library version 5.0.90 differs from your MySQL server version 5.1.49. This may cause unpredictable behavior.
edit:
manually installed phpmyadmin
then manually installed libmcrypt (which is an accomplishment with my cruddy sever skills :D) so that phpmyadmin works.
Then accidentally found out how to login as root via plesk (the trick is to enter webadmin without choosing any database), at least I think it's root :S
ran the sql: GRANT SELECT ON mysql.* TO 'my-user'#'localhost'; with a success message
went back to plesk to see if I can manage the sql with "my-user" and no, its still missing from the available users, but the name is still reserved...
tried to run: mysql_fix_privilege_tables –user=root –password=mypasswordobviosuly –verbose
but gave and error, and i'm still not sure how to run direct mysql commmands without using ssh (because i dont know the root password)
I entered mysql via pre-installed phpmyadmin as 'root' like so:
(in plesk) home-> database servers -> webadmin.
Then choose the "mysql" database, if the table 'servers' is missing (probably some mysql bug) then it will need to be created:
choose 'SQL' in 'phpmyadmin' to and run the following sql:
CREATE TABLE `servers` (
`Server_name` char(64) NOT NULL,
`Host` char(64) NOT NULL,
`Db` char(64) NOT NULL,
`Username` char(64) NOT NULL,
`Password` char(64) NOT NULL,
`Port` int(4) DEFAULT NULL,
`Socket` char(64) DEFAULT NULL,
`Wrapper` char(64) NOT NULL,
`Owner` char(64) NOT NULL,
PRIMARY KEY (`Server_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table';
so that the table at least exists... then create a new user in plesk, and viola! it works! I was able to login as the user I created after that, it seems like it was some bug with some mysql update I did not even know about.
This error can sometimes appear after a new installation of MySQL when the mysql table does not get created properly. Running the command...
mysql_install_db --user=mysql
from the bash prompt (not the MySQL prompt) will install the table and get things working.
After running the command above on a new installation the following command will help secure the install...
mysql_secure_installation
This will prompt you to enter a root password, remove anonymous access, limit root access to localhost only and remove the test database.
These commands are for Linux, they may not work on Windows but there are corresponding commands if you search the MySQL docs.
This is not related to the Plesk issue of the original poster but I stumbled upon this question while researching a MySQL installation problem and thought this might help save someone some time.
Found the following when attempting to upgrade. Was directed to the following page:
http://kb.parallels.com/en/112290
I ran the following from that page:
"Run the following command for repairing MySQL table:
#mysql_upgrade -T --debug-check -u admin -p`cat /etc/psa/.psa.shadow` mysql"
It looks like your user does not have access to the mysql database. You may want to grant the SELECT command as follows:
GRANT SELECT ON mysql.* TO 'your-user'#'localhost';
In my case show tables in mysql database identifies servers table exists, but yet I got the Error Table 'mysql.servers' doesn't exist error.
Listing <data-dir>/mysql directory revealed servers.frm file exists, but relative servers.MYI and servers.MYD files were missing - maybe I played a role on that!
Anyhow knowing that I'm using the server as an intermediate server in a Daisy Chain Replication, I got a backup from servers.frm file and recreated the table by running the #timo-huovinen's answer things got back to normal.
It's noteworthy that there was at least one other table (plugin) missing MYI and MYD files.
Related
I'm using Ubuntu 16.04 and I'm able to use MySql from the command line fine. I can create a db, add tables, add rows to tables, get queries etc.
What I can't do is write an sql file and run it.
From a regular terminal I change into the directory containing my script test.sql
Then I run mysql -u root -p > test.mysql and it asks me for my password. If I put the wrong password I get an error and if I put the correct password nothing happens, the terminal behaves as if its expecting further input.
If I have MySql started and I do
mysql>SOURCE /home/ryan/MYSQL_Scripts/test.sql
I get Failed to open file '/home/ryan/MYSQL Scripts/test.sql', error: 2
I know this means the file could not be found or supposedly does not exist yet from my explorer I right clicked on the file to get info on its path so I think the path is okay.
I don't think there's anything wrong with my script since I can run the commands individually from the mysql prompt. Here's my script:
USE first_db;
CREATE TABLE Department(id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(30) NOT NULL);
CREATE TABLE Employees(id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(30) NOT NULL,
department_id INT(6) NOT NULL);
INSERT INTO Department (name) VALUES ("Fire");
SELECT * FROM Department;
I of course have a db, first_db, already created and am able to interact w/ it from the mysql prompt I just need help using mysql scripts.
Some advice would be much appreciated. Thanks!
`
JNevill's method worked right away, mysql -u root -p < test1.sql is the correct command to execute a mysql script from the command line.
Robert Harvey is onto something w/ the path reference. Not sure yet why the path I've used is incorrect though.
I am at a very beginner level. I am creating a website, and did all of it with Wordpress on localhost. Now I bougth a domain name with GoDaddy hosting, and would like to pass my site from this local server to the live site.
I followed steps of these tutorials :
http://www.wpexplorer.com/wordpress-local-to-live/
-//- wpbeginner.com/wp-tutorials/how-to-move-wordpress-from-local-server-to-live-site/
But when getting to step 4 ( for the both of them) which is "Upload Database File into New Database / Importing WordPress Database on Live Site"
I am confronted to a problem I cannot seem to resolve even with all the online manuals and forums.
SQL query:
--
-- Database: `a'
--
CREATE DATABASE IF NOT EXISTS `a`
DEFAULT CHARACTER SET latin1
COLLATE latin1_swedish_ci;
MySQL error message:
#1044 - Access denied for user 'x'#'localhost' to database 'a'
-> I created a MySQL database (online) in Cpanel Interface named "arctic" user "artic" used as well "paul" or others to try to see if the problem came from that.
--> then I exported my database on phpMyAdmin (on local) to a .sql file. changed the lines mentioning http://localhost/arctic to www.arctic-international.com as advised in a those tutorial (the 1st one)
---> NOW I try to import this file to the phpMyAdin (online) and I get this message
SQL query:
--
-- Database: `arctic`
--
CREATE DATABASE IF NOT EXISTS `arctic`
DEFAULT CHARACTER SET latin1
COLLATE latin1_swedish_ci;
MySQL error message:
#1044 - Access denied for user 'cpses_arkjRXZnzq'#'localhost' to database 'arctic'
I do not understand and even tried to create user "cpses_arkjRXZnzq" and grant it all permisions but it still doesn't work.
I am not expert at all but I'm trying to learn, but I do need this site up and running and would really do with some help. SO please if you have any idea it would be great to hear about it.
Thanks in advance !
I'm using MySQL 5.7.10 and Flyway to handle my database migrations. Everything works fine on Linux and Mac but on Windows 10 I am getting this error:
Error on rename of '.\mydb\#sql-1da0_a.frm' to '.\mydb\proc_error_table.frm' (Errcode: 13 - Permission denied)
This is part of the SQL in question causing the error:
DROP TABLE IF EXISTS `proc_error_table`;
DROP TABLE IF EXISTS `error_import`;
CREATE TABLE `proc_error_table` (
`procedure_name` varchar(30) NOT NULL,
`sql_state` varchar(20) NOT NULL,
`sql_message` varchar(100) NOT NULL,
`error_timestamp` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create index idx_proc on proc_error_table(procedure_name);
#
# This is the line causing the error.
#
create index idx_file_id on proc_error_table(data_set_file_id);
I tried explicitly defining a tmpdir with sufficient privileges but that didn't work:
tmpdir = C:/temp
I tried to give explicit FULL ACCESS to the data FULL ACCESS to the MySQL Data directory but that didn't work:
C:\ProgramData\MySQL\MySQL Server 5.7\Data\mydb
I tried changing the user that MySQL runs as to my personal account and that didn't work.
Something, somewhere is preventing MySQL from gaining access to this directory and or file(s). The Windows Event Log, nor the MySQL show any indications as to what is preventing it.
What tool can I use to figure this out?
it could be a conflict with antivirus software. try to turn it off
I have a local wamp server and a live phpmyadmin/mysql via cpanel.
I am trying to import the wamp one into the live one. I have done this before without issue for different sites but this time I get
Create database if not exist 'test'
#1044 - Access denied for user 'c2920553'#'localhost' to database 'test'
My local database is called simply 'test' but my live one is called 'c2920554_test'
I am sure I am doing something wrong but I can't figure it!
Very happy to post more info if needed
I deleted out of the WAMP export the line that said
CREATE DATABASE IF NOT EXISTS `test` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `db-name`;
and now it seems to work.
I don't know why though...
I have a website written in php and mysql (written by someone else) and I need to alter it- just for your interest it is bridgetjonesart.co.uk. So I thought I would download it to my desktop pc and use easy php and mysql locally to make changes then upload it again.
I seem to have downloaded everything okay. I first just tried to run existing php using Easy Php and got
Warning: mysql_connect(): Access denied for user 'runningc'#'localhost' (using password: YES) in C:\Program Files (x86)\EasyPHP-12.1\www\backup from runningc\public_html\bridgetjonesart.co.uk\mysqlLogin\mysql_connect.php on line 6
Could not connect to database. Error
I have the sql database as a file 'runningc_bjart.sql' in the root directory but I think the php cant see it so I tried to use easy php administration, phpmyadmin and thought perhaps I should import the 'runningc_bjart.sql' file. So I tried and got an error message ...
Error
SQL query:
--
-- Table structure for table `Blog`
--
DROP TABLE IF EXISTS `Blog` ;
MySQL said: Documentation
#1046 - No database selected
I am not sure what to try next, any help would be really appreciated.
Thank you. Bridget
The error messages are VERY clear.
Error #1: You're using the incorrect credentials, or have forgotten to grant rights on your database to the credentials you're using.
Error #2: You've forgotten to set a default database, so MySQL has no idea which database it should be looking in for the table you're trying to drop.
e.g. you need
mysql_select_db('mydatabase');
or change your DROP query to be
DROP TABLE mydatabase.Blog;
With phpmyadmin, create a new database named runningc_bjart and import the file there. Then search in your project for a config file where the db password is set and change it with your local mysql password