I'm running Mariadb 10.1.22 on Centos 7 and I am getting this error message when I'm trying to start the mysql service. I haven't changed the configuration file at all and I have pasted below what the file says about where my pid file is located
pid-file=/var/run/mariadb/mariadb.pid
On my server it doesn't have a run folder under the var folder but run is located on the base directory so I created a directory called mariadb in the run directory and added a file called mariadb.pid and used the chown command to assign it to the mysql group and then restarted and that did nothing. Does anyone know how to solve this issue?
Also running the rpm -qa mariadb* command sho
Maybe you are using a configuration file from MySQL, where this variable is written with the dash "pid-file", but for MariaDB according to documentation [1], you have to use an underscore "pid-file". It is not necessary to create new MariaDB directory in var/run, just use this parameter in your mariadb.cnf:
pid_file = /var/run/mysqld/mysqld.pid
[1] https://mariadb.com/docs/ent/ref/mdb/system-variables/pid_file/
Related
I don't want to install MySQL on my computer, I don't want to change configuration of my OS, I want just start the mysql process writing the db on a local folder given from parameters.
I downloaded the mysql bundle from the mysql web site, and tried to start it using the mysqld command inside the bin folder in this way:
./bin/mysqld -b /Users/me/tools/mysql-5.6.28-osx10.10-x86_64 -h ~/Projects/my-project/db
But I have this error when it executes:
2016-01-25 11:13:24 33251 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
Everyone can read and write in the db folder, what can be the problem?
Solved.
I found this page in the mysql doc http://dev.mysql.com/doc/refman/5.7/en/binary-installation.html.
To create and start a new db is needed to execute mysql_install_db (before Mysql v5.7.6) using the appropriate datadir and basedir.
In MySQL 5.6 the script is located under the scripts folder, not in the bin folder as is wrote in the docs.
I installed MySQL community server 5.7.10 using binary zip. I extracted the zip in c:\mysql and created the data folder in c:\mysql\data. I created the config file as my.ini and placed it in c:\mysql (root folder of extracted zip). Below is the content of the my.ini file
# set basedir to your installation path
basedir=C:\mysql
# set datadir to the location of your data directory
datadir=C:\mysql\data
I'm trying to start MySQL using mysqld --console, but the process is aborted with the below error.
2015-12-29T18:04:01.141930Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2015-12-29T18:04:01.141930Z 0 [ERROR] Aborting
Any help on this will be appreciated.
You have to initialize the data directory by running the following command
mysqld --initialize [with random root password]
mysqld --initialize-insecure [with blank root password]
The mysql_install_db script also needs the datadir parameter:
mysql_install_db --user=root --datadir=$db_datapath
On Maria DB you use the install script mysql_install_db to install and initialize. In my case I use an environment variable for the data path. Not only does mysqld need to know where the data is (specified via commandline), but so does the install script.
mysqld --initialize to initialize the data directory then mysqld &
If you had already launched mysqld& without mysqld --initialize you might have to delete all files in your data directory
You can also modify /etc/my.cnf to add a custom path to your data directory like this :
[mysqld]
...
datadir=/path/to/directory
As suggested above, i had similar issue with mysql-5.7.18, i did this in this way
1. Executed this command from "MYSQL_HOME\bin\mysqld.exe --initialize-insecure"
2. then started "MYSQL_HOME\bin\mysqld.exe"
3. Connect workbench to this localhost:3306 with username 'root'
4. then executed this query "SET PASSWORD FOR 'root'#'localhost' = 'root';"
password was also updated successfully.
I had the same problem. For some reason --initialize did not work.
After about 5 hours of trial and error with different parameters, configs and commands I found out that the problem was caused by the file system.
I wanted to run a database on a large USB HDD drive. Drives larger than 2 TB are GPT partitioned! Here is a bug report with a solution:
https://bugs.mysql.com/bug.php?id=28913
In short words: Add the following line to your my.ini:
innodb_flush_method=normal
I had this problem with mysql 5.7 on Windows.
My problem was caused by an incorrect db restore.
When I dumed the db it also picked up the system mysql tables because I added a space after -p as mentioned here: mysqldump is dumping undesired system tables
Launching the docker instance would work, then I'd restore (and corrupt) the db and it would still keep running, but after restarting it would Exit with error code 1.
The solution was to dump and restore properly without the system tables.
I face the same issue with version Mysql 5.7.33 when the server has rebooted. I fix it by copy other server user files scp /var/lib/mysql/mysql/user.* root#dest:/var/lib/mysql/mysql.
I'm installing Apache server, php, and MySQL on Windows10.
First two was successful but MySQL has a problem.
I installed MySQL into C:\mysql-5.7.10-winx64, and changed my.ini like this
basedir = C:/mysql-5.7.10-winx64
datadir = C:/mysql-5.7.10-winx64/data
port = 3306
I succeeded install but if I try to start, it shows like below
C:\Windows\system32>net start mysql
The MySQL service is starting.
The MySQL service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.
However, if I check Computer Management>Event Viewer>Custom Views>Summary page events, it tells me "failed to set datadir to C:\mysql-5.7.10-winx64\data\"
If I make data folder manually, error message changed to
Can't open the mysql.plugin table
Please run mysql_upgrade to create it.." and some files are created in data folder
I tried to upgrade by typing mysql_upgrade but it failed.
mysql_upgrade: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) while connecting to the MySQL server. Upgrade process encountered error and will not continue.
How can I solve this issue?
Clear the "data" directory, then run command mysqld --initialize, and the command net start mysql, bingo!
1.For the error,
2003: Can't connect to MySQL server on 'localhost' (10061) while connecting to the MySQL server. Upgrade process encountered error and will not continue.
I ran the cmd as administrator and then go to \Program Files\MySQL\MySQL Server 5.7\bin\, and run
mysqld install
2.For the error,
C:\Program Files\MySQL\MySQL Server 5.7\bin>net start mysql
The MySQL service is starting.
The MySQL service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.
Try
mysqld --initialize
and then
net start mysql
Thanks to Athan's answer. Those combination worked for me.
I also had the same problem and I wasted hours solving the issue, but in the end this worked.
Go to you C:\ProgramData\MySQL\MySQL Server 5.7 and copy the my.ini file from there.
Go to C:\Program Files\MySQL\MySQL Server 5.7 and paste it there.
Open cmd and run net start mysql
It would work like a charm.
Explanation:
MySQL couldn't find my.ini, therefore tried to create data in Program Files... where it had no rights to do so, therefore it says access denied every time you run it.
This is old but I was running into the same problem you were seeing. I thought I'd share this answer for anyone looking. I created the data directory as you did initially and tried to start the service and got "Can't open and lock privilege tables: Table mysql.user doesn't exist." I then deleted the contents of the data directory and instead initialized the data directory by running the following command from the bin folder.
mysqld --initialize [with random root password]
mysqld --initialize-insecure [without random root password]
I had the same error, after checked this document: https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization.html
I just clear data directory and add the --console option to initialize:
bin\mysqld --defaults-file=C:\my.ini
--initialize --console
Hope this help
MySQL Server can either be run as a Program or as a Service. You cannot run both. You should stop 'mysqld' Server Program before starting 'mysqld' Server as Service.
The 'mysqld' Server Program can be stopped either by typing
'CTRL + c' or by issuing
'mysqladmin -u root -p shutdown' command and issue the password when prompted.
You need download from https://dev.mysql.com/downloads/mysql/ previous GA versions, and after that copy directory "data" to your new mysql or outher directory what you write in configfile my.ini in directory mysql-"version" .
For your error, main cause is in your my.ini setting.
Since you are installing MySQL on Windows, you should define path like:
basedir = C:\\mysql-5.7.10-winx64
datadir = C:\\mysql-5.7.10-winx64\\data
These slashes must be doubled.
Then start your MySQL service again. I guess this time would work.
And here is official document from MySQL.
This saved my life,
Just turn off the windows firewall and Give he port number correctly as 3306 as default, then restart MYSQL server . After that turn on the windows defender firewall
Just work it fine.
Looks like my solution is not added yet,
I've installed mysql80 , edited my.ini in windows notepad and got the same error like topic author "... NET HELPMSG 3534." when I start mysql service,
and my issue was in extra bytes added by notepad at the begining (EB BB BF) on my.ini, when I edited (added the same changes) my.ini in other editor everything worked fine.
I have an external HD and i'd like to run a 2nd mysql instance on it. I used the windows installer to install/configure mysqld as a service on windows7. I took the my.ini from
C:\Program Files\MySQL\MySQL Server 5.5\my.ini
Then edited the port (client and mysqld), datadir and innodb_data_home_dir. After running this command
"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="f:/dev/my.ini"
I found an error which was all about the innodb_data_home_dir directory not existing. After that I ran the command again. Mysqld simply starts up for a second then immediately closes. I see no message in my command prompt. I know this command line args are correct as i see the mysqld service using the same one except a different my.ini path. Also it did tell me about the directory not existing so i know it is reading the new ini file.
How do i figure out why this 2nd instance of mysqld is closing? How do i get 2 instance running?
I'm using v 5.5
Mysql documentation is idiotic and their packaging is lacking (it is missing mysql_install_db). I have to download mysql-5.5.28-win32.zip (careful not mysql-5.5.28.zip under windows 32. Its source which is not mentioned at all) then copy performance_schema/ and mysql/ to the data directory THEN mysqld can run...
Heres the deal. Removed mysql 5.0.xx and neglected to dump a data folder which is on a mounted drive.
I have mySql 5.6.5 now installed and running and the data folder works fine in the default directory. I attempted to switch the data dir in the my.conf file but that results in the error "The server quit without updating PID file."
What I would like to do is still have my.conf point at the default data directory while also adding the external database to MySQL. This is how I had it set up in mySql 5.0.xx. The only problem is I created the database via a GUI and specified that the data would actually be stored in the mounted drive. I can't quite figure out how to do this via the command line and I have found no good sources of documentation or examples.
You probably created a symbolic link to the directory on the mounted drive. This is done with the ln command:
cd /var/lib/mysql
ln -s /mounted_drive/data_directory/db_name db_name
On Ubuntu the MySQL data folder resides in /var/lib
Generally you can set this variable in my.cnf http://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_datadir in order to change the default data directory.