How to create new server in mysql on windows? - mysql

I installed mysql 8.0. During the process of install, it will guide you to create a server that is registered as window service. For example, by default it will put server related file on the (base)path "C:\ProgramData\MySQL\MySQL Server 8.0" using default port 3306. What if I want to create another server?What should I do? Maybe using mysqld --initialize?

Well make sure you have installed a running and properly configured MySQL Server and Instance. If so, copy the data directory of your running MySQL Instance (Server) in a second folder.
Existing Folder: C:\ProgramData\MySQL\MySQL Server 5.7
New Folder (for example): C:\ProgramData\MySQL\MySQL second Server 5.7
NEXT: Create 2 Option-Files (a ka .txt files, you save as my-opts[Optummber.cnf)]. You may create one file named C:\ProgramData\MySQL\my-opts1.cnf that looks like this:
File 1 Content:
[mysqld]
datadir = C:\ProgramData\MySQL\MySQL Server 5.7\mydata1
port = 3307
Create a second file named C:\ProgramData\MySQL\my-opts2.cnf that looks like this:
[mysqld]
datadir = C:\ProgramData\MySQL\MySQL second Server 5.7\mydata2
port = 3308
NEXT: Use the --defaults-file option to start each server, runnig on its own option file:
C:\> C:\ProgramData\MySQL\bin\mysqld --defaults-file=C:\ProgramData\MySQL\my-opts1.cnf
C:\> C:\ProgramData\MySQL\bin\mysqld --defaults-file=C:\ProgramData\MySQL\my-opts2.cnf
Note: Each will start visibly, with a new prompt until the server exits later), so you will need to issue those two commands in separate console windows.
To shut down the servers, connect to each using the appropriate port number:
C:\> C:\ProgramData\MySQL\bin\mysqladmin --port=3307 --host=127.0.0.1 --user=root --password shutdown
C:\> C:\ProgramData\MySQL\bin\mysqladmin --port=3308 --host=127.0.0.1 --user=root --password shutdown
Servers configured as just described permit clients to connect over TCP/IP. - If you want to do so, please follow the guide on: https://dev.mysql.com/doc/refman/8.0/en/multiple-windows-command-line-servers.html
Note: I wrote the commands in here based on https://dev.mysql.com/doc/refman/8.0/en/multiple-windows-command-line-servers.html. Please modify them according to your file System and MySQL Configuration. I don't take any warranty for them. If the used filepaths seem to complicated for you, please change them to the eased up versions in the linked description. Setting up mySQL Instances might be a challenging process, just do so, if you can handle it.

Related

how to change port number in MySQL Server 5.6 on windows( Not in XAMPP inbuilt mysql)

I stopped the MySQL Service in Windows from TaskManager Option.
And then, I opend and Choosed the port number in "my-default.ini". like following (C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini)
[mysqld]
port = 33062
Saved It.
Then I stated the service 'MySql' from the 'TaskManager'.
I checked the port number from 'mysql command' prompt. but port number is not changed to 33062. Instead of that default port number is there in the 'my.ini' file.
Please show the way to change it.
Steps to change the port number for MySQL Server 5.7 :
Stop the MySQL service from services.msc(To open services.msc go to run command and then type services.msc)
Go to the location C:\ProgramData\MySQL\MySQL Server 5.7 (ProgramData is a hidden folder. So you need to enable the hidden items from Folder Options).
In the MySQL Server 5.7 folder you will find my.ini file.
Open my.ini file and search for port.
Give your desired port number (like port=3632).
Save and exit my.ini file.(if it brings a file owner error, the quickest hack is to rename the file, edit it accordingly and then save the file as 'my.ini'. You can then proceed to delete the first renamed file.)
Then stat the service from the services.msc.
Follow the following simple steps
Rerun the installer by going to start > MySQL > MySQL Community Installer
https://i.stack.imgur.com/s78DN.png
Click on Reconfigure next to MySQL Server
Click and Next
Now change the port numbers to maybe 3309
https://i.stack.imgur.com/zs5Vu.png
Click Next change the password, test it and that ends it

How to change the default port of mysql from 3306 to 3360

I want to change the default port number of MySQL server presently it is 3306. I want to change it to 3360.
I have tried:
-- port=3360
But things are not working for me. Please provide query to change port not any configuration. I am using Windows 8 64 bit.
You need to edit your my.cnf file and make sure you have the port set as in the following line:
port = 3360
Then restart your MySQL service and you should be good to go. There is no query you can run to make this change because the port is not a dynamic variable (q.v. here for MySQL documentation showing a table of all system variables).
If you're on Windows, you may find the config file my.ini it in this directory
C:\ProgramData\MySQL\MySQL Server 5.7\
You open this file in a text editor and look for this section:
# The TCP/IP Port the MySQL Server will listen on
port=3306
Then you change the number of the port, save the file.
Find the service MYSQL57 under Task Manager > Services and restart it.
On newer (for example 8.0.0) the simplest solution is (good choice for a scripted start-up for example):
mysqld --port=23306
When server first starts the my.ini may not be created where everyone has stated. I was able to find mine in C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.6
This location has the defaults for every setting.
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
# pipe
# socket=0.0
port=4306 !!!!!!!!!!!!!!!!!!!Change this!!!!!!!!!!!!!!!!!
[mysql]
no-beep
default-character-set=utf8
Go to installed mysql path and find bin folder,open my.ini and search 3306 after that change 3306 to 3360
Actually, you can just run the service using /mysqld --PORT 1234, it would force mysql to run on the specified port without change the cnf/ini file.
I just cought a case that cnf didn't work. It was weired... so I just use the cmd line as the shortcut and it works!
try changing the connection port to 8012
open xampp as administrator
Mysql config => my.ini change the port from 3306 to 8012
close and run it again
I hope it will work.
If you are using windows and installed the database as a service, which is the default, you should find your configuration file by opening your services management console.
For instance: win + r and then type services.msc
Look for a service called MySQL or MariaDB.
On the general tab of the properties of this service you can find a path to your mysqld.exe file and the arguments to start the exe. The --defaults-file argument should point to your configuration file.
Edit your configuration file and restart the MySQL service.
In Windows 8.1 x64 bit os, Currently I am using MySQL version :
Server version: 5.7.11-log MySQL Community Server (GPL)
For changing your MySQL port number, Go to installation directory, my installation directory is :
C:\Program Files\MySQL\MySQL Server 5.7
open the my-default.ini Configuration Setting file in any text editor.
search the line in the configuration file.
# port = .....
replace it with :
port=<my_new_port_number>
like my self changed to :
port=15800
To apply the changes don't forget to immediate either restart the MySQL Server or your OS.
Hope this would help many one.
Change my.cnf file and add this line or change it port=3360
at my fedora 34
sudo vi /etc/my.cnf
add This line ==> port=3360
The best way to do this is take backup of required database and reconfigure the server.
Creating A Backup
The mysqldump command is used to create textfile “dumps” of databases managed by MySQL. These dumps are just files with all the SQL commands needed to recreate the database from scratch. The process is quick and easy.
If you want to back up a single database, you merely create the dump and send the output into a file, like so:
mysqldump database_name > database_name.sql
Multiple databases can be backed up at the same time:
mysqldump --databases database_one database_two > two_databases.sql
In the code above, database_one is the name of the first database to be backed up, and database_two is the name of the second.
It is also simple to back up all of the databases on a server:
mysqldump --all-databases > all_databases.sql
After taking the backup, remove mysql and reinstall it. After reinstalling with the desired port number.
Restoring a Backup
Since the dump files are just SQL commands, you can restore the database backup by telling mysql to run the commands in it and put the data into the proper database.
mysql database_name < database_name.sql
In the code above, database_name is the name of the database you want to restore, and database_name.sql is the name of the backup file to be restored..
If you are trying to restore a single database from dump of all the databases, you have to let mysql know like this:
mysql --one-database database_name < all_databases.sql

app can't connect to local MySQL - osx

I am running some rails app on osx, but when I launch a rails generate command type, I get this message :
/$root/vendor/bundle/ruby/2.0.0/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (Mysql2::Error)
For info, my mamp server is running, and the connection must pass through /Applications/MAMP/Library/bin/mysql, so I aliased it by setting in my bash profile :
alias mysql="/Applications/MAMP/Library/bin/mysql"
Btw, what is weird, is that my rails s command works perfectly, so my app can connect to the apache server in that case
So the trick was to simply /tmp/mysql.sock to /Applications/MAMP/tmp/mysql/mysql.sock
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
The error indicates that "mysql is not started/running". From what you describe, looks like the new location pointed to the alias has no mysql or its mysql is not started.
Look my.cnf file with the correct parameters in the new location:
/Applications/MAMP/Library/bin/mysql
Another trick is to list your running processes and look for mysql.
Also, are you sure, "rails c" is not using the sqlite3 vs mysql?
Updated:
*Courtesy of #bfavaretto
MySQL my.cnf location on OS X?
By default, the OS X installation does not use a my.cnf, and MySQL just uses the default values. To set up your own my.cnf, you could just create a file straight in /etc.
OS X provides example configuration files at /usr/local/mysql/support-files/
Update:
Take a look at this:
https://stackoverflow.com/questions/4788381/getting-cant-connect-through-socket-tmp-mysql-when-installing-mysql-on-m

ERROR 2003 (HY000): Can't connect to MySQL server on localhost (10061)

I installed MySQL on Microsoft Windows 8 Using a noinstall Zip Archive. But when I tested by executing the following commands on windows prompt, the above error showed up.
C:\> "C:\MySQL\bin\mysqlshow"
C:\> "C:\MySQL\bin\mysql" test
You don't need to restart your windows. The easiest way to achieve this is
Go to <Extracted folder location>/bin/
Run mysqld (service)
close the cmd prompt
Run mysql.exe or the better way to do is add the location to PATH environment Variable
Go to Run type services.msc. Check whether MySQL services is running or not. If not, start it manually. Once it started, type mysqlshow to test the service.
Go to bin directory copy the path and set it as a environment variable.
Run the command prompt as admin and cd to bin directory.
Run command : mysqld –install
Now the services are successfully installed
Start the service in service windows of os
Type mysql and go
Though it is an old question, I am adding my answer in it, because the solution that worked for me on Windows 7 as an admin user, is missing in the answers' list. Though my solution is for installed MySQL, I am putting it for those who search for a solution for this error message. Here it is:
Click on the Windows 7 start button and type taskmgr in the search bar
Right click on the taskmgr program icon and select Run as administrator
In the Task Manager window, go to the Services tab
Right click on the MySQL service and click Start Service
The solution that worked for me is:
Downloaded mysql-8.0.22-winx64.zip file
Extracted the zip file
Moved the extracted folder to C:/Program Files
Opened cmd.exe as admin
Navigated to the directory cd C:\Program Files\mysql-8.0.22\mysql-8.0.22-winx64\bin
mysqld -install (Service successfully installed)
mysqld --initialize (no prompt)
Opened services.msc
Found MySQL
Right-click and start
I was stuck on this same issue for what felt like an eternity.
My problem was: I was running mysql from MAMP on port 8889, but when trying to connect to mysql from my command line, it was expecting port 3306. I was running out of ideas, so I tried:
mysql --port 8889
and happiness ensued:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.34-log MySQL Community Server (GPL)
Go to Run type services.msc. Check whether MySQL services is running or not. If not, start it manually.
Run your cmd as administrator.
What you will see is like this:
c:\windows\system32>
Go to your bin location by using cd..
like C:\mysql\bin (my location of bin in my computer is what you are seeing so chose yours correctly)
Run:
$ C:\mysql\bin>mysql --install
Service successfully installed.
Then run:
$ C:\mysql\bin>NET START MySql
The MySql service is starting
The MySql service was started successfully
Then the last step is running:
C:\mysql\bin>mysql -u root - p admin
It will ask for password don't enter anything first time
because it will use blank, and just press enter you are done.
And later you can set password too.
I have a windows 8.1 machine and mysql was not running at all even after trying to start mysqld with no error logs. This solution worked for me:
start cmd in admin mode
type in "net start mysql"
close current cmd window and open new cmd window
type in "mysql"
The mysqld service should now be available.
Had this issue in Windows 10 and MySQL 8. Resolved by following steps:
Searchbar(bottom left) > Task Manager > Run as administrator > Services > MySQL80
Well that could have some reasons.
THe first one is that the MySQL server/service not started.
If he is started you should check out the logfiles, and make sure there are no problems.
You could also uninstall the MySQL service and install XAMPP.
With XAMPP it is easier to manage this services.
Despite that my server was running, I had the same problem.
I found out that it was the port. So you need to specify the port:
mysql -u user -p --port 0000
The port on your machine may be different. To find out on which port mysql is running open the mysql ini file and look for port=. A port often used is 3306.
Example how to log on to mysql
mysql -u root -p --port 3306
Test if the server is running. You can use netstat for this. See https://serverfault.com/questions/260239/unable-to-connect-to-mysql-through-port-3306
If it is running, it may be the firewall. You can turn that off to test if that is the problem.
See the following manual to install Mysql as a service: https://dev.mysql.com/doc/refman/5.5/en/windows-start-service.html
First of all, you need to ensure the port number on which the server is running. Then you can run
mysql -u username -p --port portNumber
on the command line
Executing the mysqld command can solve your problem.
My SQL version is 5.7.
If you're using the no install zip, you need to execute mysqld.exe first to start the service, and then execute mysql.exe to open your connection.
The no install is nice, but if you intend to do any serious work with MySQL, you may want to consider either using the MSI to do a proper installation, or if you're doing web development work give XAMPP a try.
Check Mysqld.exe file is in your bin folder. if it is not there , just copy that file from any other computer and paste it on your bin folder.Just double click. Then run mysql.its solved
This error is flashed when we are trying to open mysql with out stating the service.
Open cmd prompt
to start the service type
mysqld --console
This will start the mysql service
Don't close this cmd prompt and open a new cmd prompt and
type
mysql -u root -p
Then enter ur password
Make sure your mysql is running in default port (3306) , if you are running mysql with different port (for example: 3307), you must specified the port number while connecting to the server.
If your port is different than default port, then try with this command.
mysql -u <username> -p --port<port number>
For eg:
mysql -u root -p --port 3307
Go and search Services in Windows
Now search Mysql. Right Click on it. By Default it's startup type will be 'Automatic'. Click on Properties on right clicked menu.
You will find startup type Switch it to -> Manual So that We can start and stop by our choice.
Now Get Back and Right Click to Mysql on Services and Click Start.
Now Mysql has started successfully
To get started
Start Mysql Shell
& type command
shell.connect({host: 'localhost',user: 'root'})
Now type password
To type sql commands:-
/sql
I had the same problem. I tried all of the answers above (and some from other websites). In the end, my issue was that my cache wasn't configured. I found that info in my error log and fixed it by changing the line in the file:
C:\MAMP\bin\apache\conf\extra\http-ssl.conf
There I removed the double quotes from the line:
SSLSessionCache "shmcb:/some/example/path/ssl_scache(512000)"
to:
SSLSessionCache shmcb:/some/example/path/ssl_scache(512000)
and saved with Ctrl+S and closed the file.
Here's the link that helped me:
https://wiki.apache.org/httpd/SSLSessionCache
I faced the same problem couple of times and each time the reason was different:
The solution that worked first time was that by "Abhishek Oza" which is same as that of "amey91" (see above)
The second time, my server was on a different port number than the default one(3036),so i was not able to connect.So I had to specify
the port number explicitly for making the connection which you can do
simply by writing: "mysql --host=127.0.0.1 --port=8081(specify your
port number here) mysql -u root -p"
In my case, which was a manual install using the .zip file.
I solved this by specifying the nonstandard MySQL and Data install locations in a my.ini.
https://dev.mysql.com/doc/refman/8.0/en/windows-create-option-file.html
Then I needed to run the data directory initialisation commands:
https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization-mysqld.html
Then running:
net start mysql
There is a possibility that your installation of MYSQL got corrupted. The best thing you can do is to search for MYSQL INSTALLER on your system and then run it again.
It will not download the mysql server again, it will just help you to set it up.
After that, edit your environment variables path and add the bin folder of your mysql to it.
By now, it should work.
In my case I have 2 different version of mysql in Windows OS and I solved the my problem by bottom step:
first stop all mysql service.
I create one config file in C:\mysqldata.cnf with bottom data(my mysql is in "C:/mysql-5.0.96-winx64" directory ):
[mysqld]
datadir = C:/mysql-5.0.96-winx64/data
port = 3307
then I run bottom command in cmd:
C:\mysql-5.0.96-winx64\bin\mysqld --defaults-file=C:\mysqldata.cnf --console
above step reference
then I create txt file in C:\resetpass.txt with bottom data:
UPDATE mysql.user SET password=PASSWORD('ttt') WHERE user='root';
then run mysqld with bottom command:
C:\mysql-5.0.96-winx64\bin\mysqld --init-file=C:\resetpass.txt --install mysql2 --console
net start mysql2
after these step you have one mysql service(with name mysql2) than run with port 3307.
I have 2 version of mysql with different user management tables(in version 5.0.96 user table difference with 5.5 version because of that I must be change table folder in first step)
you can run other mysql service with other port now(and you can run this steps with different datadir, service name and port for it again)
First make sure you have installed MYsql+Sqlyog(if you are using it.).
Start Registry Editor (Regedt32.exe).
Locate the following key in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
On the Edit menu, click Add Value, and then add the following registry value:
Value Name: MaxUserPort
Data Type: REG_DWORD
Value: 65534
This sets the number of ephemeral ports available to any user. The valid range is
between 5000 and 65534 (decimal). The default value is 0x1388 (5000 decimal).
On the Edit menu, click Add Value, and then add the following registry value:
Value Name: TcpTimedWaitDelay
Data Type: REG_DWORD
Value: 30
This sets the number of seconds to hold a TCP port connection in TIME_WAIT state before
closing. The valid range is between 30 and 300 decimal, although you may wish to check
with Microsoft for the latest permitted values. The default value is 0x78 (120 decimal).
Quit Registry Editor.
Reboot the machine.
I will advise to use first check if my.ini exist in mysql folder in c drive or in windows folder
mysqld -install (Service successfully installed)
mysqld --initialize (no prompt)
Also another advise is not to use mysql 8, since it is not compatible with wordpress or any other opensource yet, there are lot of changes between version 5 and version 8, so if you are using mysql please use version 5.x.
Steps to resolve the problem ->
Go to command prompt and at root of c (c:\ if environment variable-path is set)
type -> c:\>mysqld -install.
Then type -> c:\mysqld --initialize
Now create one .txt file (here in our example we are taking init.txt) at root of mysql(may vary according to your directory) ->c:\MySQL\init.txt.
Now open that .txt file(init.txt) and write in it ->
5.open Run console and write -> Services.msc
6.Then Services window will be open ,there select MYSQL,Double click It and press start
7.Finally open new Command prompt window and type at root of c (c:) ->c:\>mysqlsh
due to this shell will execute and here you are ready to go....
mysql -u root --port 3308
this one help me
port number from phpmyadmin default port is 3306

How to start MySQL server on windows xp

Whenever I try to start MySQL by typing
> mysql -u root
I get the error
ERROR 2003(HY000): Can't connect to MySQL server on 'localhost' (10061)
How can I solve the problem above? I just downloaded MySQL and unzipped it in the E: drive. I have not done anything else. Do I have to make a connection first? If so, how can I do that?
Here is the ZIP file that I had downloaded: mysql-5.7.15-winx64.zip
Here are the steps to start MYSQL Server (mysql-5.7.15-winx64) for the first time on Windows:
Create a new folder named "data" in MYSQL installation directory (i.e. in the same location as where "bin" directory is located. For me it is: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64. This location will vary as per the location where you have extracted the MYSQL zip file)
From here I will use my MYSQL folder location as reference. Go to: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin and execute the command: mysqld --initialize-insecure or mysqld --initialize depending on whether you want the server to generate a random initial password for the 'root'#'localhost' account.
To start the DB, go to: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin and execute mysqld --console You can see the start-up logs being printed.
To connect to DB, go to: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin and execute mysql -u root -p. When prompted, Enter password if it has been set or else just hit "Enter" button to connect
The MySQL server can be started manually from the command line. This can be done on any version of Windows.
To start the mysqld server from the command line, you should start a console window (or “DOS window”) and enter this command:
shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld"
The path to mysqld may vary depending on the install location of MySQL on your system.
You can stop the MySQL server by executing this command:
shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin" -u root shutdown
**Note : **
If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and supply the password when prompted.
This command invokes the MySQL administrative utility mysqladmin to connect to the server and tell it to shut down. The command connects as the MySQL root user, which is the default administrative account in the MySQL grant system. Note that users in the MySQL grant system are wholly independent from any login users under Windows.
If mysqld doesn't start, check the error log to see whether the server wrote any messages there to indicate the cause of the problem. The error log is located in the C:\Program Files\MySQL\MySQL Server 5.0\data directory. It is the file with a suffix of .err. You can also try to start the server as mysqld --console; in this case, you may get some useful information on the screen that may help solve the problem.
The last option is to start mysqld with the --standalone and --debug options. In this case, mysqld writes a log file C:\mysqld.trace that should contain the reason why mysqld doesn't start. See MySQL Internals: Porting to Other Systems.
Via MySQL Official Page
If the command prompt does not work in Windows, try the following:
1) Open services in Windows.
2) Then check the status for Mysql and if you found status nothing or blank then start the mysql service.
3) After then see whether the mysql is start or not .If it shows started then try to check mysql working.
It has worked for me when cmd commands were not working.
Run the command prompt as admin and cd to bin directory of MySQL
Generally it is (C:\Program Files\MySQL\mysql-5.6.36-winx64\bin)
Run command : mysqld --install. (This command will install MySQL services and if services already installed it will prompt.)
Run below commands to start and stop server
To start : net start mysql
To stop : net stop mysql
Run mysql command.
Enjoy !!
maybe
E:\mysql-5.1.39-win32\bin>mysql -u root -p
Type
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
to start the sql server and then test the client connection.
I was using MySQL Server 5.5 as a result I was missing the folder which majority of the answers made mention of in the bin folder. What I did instead was the following:
Open Explorer and make your way to C:\Program Files\MySQL\MySQL Server 5.5\bin or your MySQL installation directory.
Run the executable application MySQLInstanceConfig and follow the images below.
This solved my issue and I was able to access the database without any errors.
Start mysql server by command prompt
C:> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --console
Or alternative reach up to bin then
mysqld --console
It will start your server.
If you have mysql command line client available
click on it
it show enter your password :
Please enter your password.
Then you can access it.
You also need to configure and start the MySQL server. This will probably help
I tried following steps to run mysql server 5.6 on my windows 8.
Run command prompt as an administrator
go mysql server 5.6 installation directory (in my case: C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin) copy that location
In Command prompt run "cd C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin"
run "mysql -u root"
You need to run the server first. The command you use (in the question) starts a client to connect to the server but the server is not there so there the error.
Since I am not a Windows user (Linux comes equipped) so I might not be the best person to tell you how but I can point to you to a guide and another guide that show you how to get MySQL server up and running in Windows.
After you get that running, you can use the command (in the question) to connect it.
NOTE: You may also try http://www.apachefriends.org/en/xampp.html if you plan to use MySQL for web database development.
Hope this helps.
The error complains about localhost rather than permissions and the current practice in MySQL is to have a bind-address specifying localhost only in a configuration file.
So I don't think it's a password problem - except that you say you 'unzipped' MySQL.
Is that enough installation? What did you download?
Was there any installation step which allowed you to define a root password?
And, as NawaMan said, is the server running?
first thing you need to do is to start the mysql
for that you can use
E:\mysql-5.1.39-win32\bin>net start mysql (only when there a mysql running as service)
then you can execute
E:\mysql-5.1.39-win32\bin>mysql -u root
Run your command prompt as administrator.#
We can start MySQL service from windows command line using the below command.
net start mysql
Command to stop MySql service:
net stop mysql
Disable MySql service:
sc config mysql start= disabled
Command to enable MySql service(to automatically start MySQL service when the system starts up):
sc config mysql start= auto
Command to set the startup type to manual:
sc config mysql start= manual
How to restart MySql service?
There is no direct command to restart a service. You can combine stop and start commands like below.
net stop mysql & net start mysql
I was also having problem with starting MySql server but run command as mention right mark in picture . Its working fine .
mysql -u root -p
After entering this command in terminal, it will ask for password
Enter the password and you are ready to go!
there is one of the best solution do resolve this problem and it is going to work 100%.
as we know that server is a process so treat it like a process go to the task manager
in windows and see for services in task manager in that service see for Mysql and MS80 and try to start it manually by click on it and say run then will take some time.
go to your mysql workbench and click on start/shutdown then try to refresh the server status in server status option. it will load up thats it.
1.Open a command prompt as Administrator.
2.Go to MySQL installed bin directory in program files.
3.Copy the location of the bin directory from windows explorer.
4.In command prompt type cd and (paste the location) and do enter.
5.Type mysqld --initialize
6.Open services from the windows menu and sort the list by name.
7.Right-click Mysql and click start.
use the command "mysql -u root -p" in the bin folder path.
and give the MY SQL password which you have set earlier.