I use windows and I have previously installed mysql 5.5 for some legacy project, and now I want to use 5.7 for a new one, so I installed 5.7 in another directory, on another port and having different data directory, my problem is when i launch mysql from cmd like:
W:\MySQL57\bin> mysql -u root -p
It results in this:
W:\MySQL57\bin>mysql -u root -p
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.54-log MySQL Community Server (GPL)
And I am definitely sure that MySQL57 is directory for 5.7 MySQL, so what's wrong with mysql command line tool and how can i fix it to be able to use both mysqls in cmd?
The mysql command you are using is probably the 5.7 version, you can check this with :
W:\MySQL57\bin>mysql -v
But this is just the client !
The problem is your server version, you may have 2 versions running (5.5 and 5.7), and as you haven't specified the port you are using the default one which is used by the first server (5.5).
Try to find the port for the second version (3307 ?) or kill the 5.5 server when you are connecting to the 5.7.
You are calling the default mysql set in Environment Variable. If you want to use a specific mysql, you need to provide the path too
W:\MySQL57\bin>"W:\MySQL57\bin\mysql" -u root -p
In case of mysql not working, you can call mysqld.
If you want mysql 5.7 to be default, just change it from Environment Variable https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html
Related
A. First things first:
Mr. Google hasn't helped me to found any reply to my question
above
Yes, I have read a solution to the opposite question here
How to upgrade MySQL to MariaDB in XAMPP in 5 minutes on Windows
(and it hasn't helped me: MySQL simply doesn't start)
I don't expect replies like 'MariaDB is better, - stop your silly
exercises'.
B. I am working with MySQL Workbench and because of that don't want to face any incompatibilities either now or in future.
C. Can someone share their experience (if any) in solving this problem?
Running XAMPP with MySQL
Here are exact step by step instructions for truly integrating MySQL into XAMPP on Windows. This has been successfully tested with Windows 10 and XAMPP 7.3.11 for both MySQL 8.0.18 and 5.7.28.
Stop MySQL (which actually is MariaDB) in the XAMPP Control Panel.
Download the MySQL community server as zip archive (Windows 64 bit version)
Rename C:\xampp\mysql to C:\xampp\mariadb
Extract the downloaded zip archive to C:\xampp\mysql. Make sure you extract the folder level which has the subfolders bin, include, lib etc.
Copy C:\xampp\mariadb\bin\my.ini to C:\xampp\mysql\bin
Open C:\xampp\mysql\bin\my.ini in an editor and comment out the line starting with key_buffer= in the [mysqld] section.
Open a command prompt and run the following commands:
For MySQL 8.0.18:
cd C:\xampp\mysql
bin\mysqld --initialize-insecure
start /b bin\mysqld
bin\mysql -u root
CREATE USER pma#localhost;
SOURCE C:/xampp/phpMyAdmin/sql/create_tables.sql;
GRANT SELECT, INSERT, DELETE, UPDATE, ALTER ON phpmyadmin.* TO pma#localhost;
ALTER USER root#localhost IDENTIFIED WITH mysql_native_password BY '';
ALTER USER pma#localhost IDENTIFIED WITH mysql_native_password BY '';
\q
bin\mysqladmin -u root shutdown
For MySQL 5.7.28:
cd C:\xampp\mysql
bin\mysqld --initialize-insecure --log_syslog=0
start /b bin\mysqld --log_syslog=0
bin\mysql -u root
CREATE USER pma#localhost;
SOURCE C:/xampp/phpMyAdmin/sql/create_tables.sql;
GRANT SELECT, INSERT, DELETE, UPDATE, ALTER ON phpmyadmin.* TO pma#localhost;
\q
bin\mysqladmin -u root shutdown
Start Apache and MySQL in the XAMPP Control Panel.
Go to http://localhost/phpmyadmin and verify that your database server is now reported as MySQL Community Server.
You can use the following way.
Stop MariaDB in Xampp which show as mysql running...
Download the installer for windows mysql Installer
Follow the instruction.
Now start Apache2 and clear cookie in your browser. Now you can see phpmyadmin and workbench showing Server type: MySQL
If you want to stick to MariaDB then you can use sqlyog also.
Hope it answer your question
You have to do little adjustment with xampp in order to use MySQL instead of MariaDB . I just did following and its worked , i think it may helpful to others also.
Download and install mysql installer.
2.stop xampp and rename the mysql folder inside the xampp directory(may be its not necessary! )
3.just start Apache only from xampp control panel . No need to start mysql.
4.Last step . Make sure your running MySQL in your system . That's it ..
Check php admin panel there you can see Server type: MySQL instead of MariaDB ...
Thanks..
I just upgraded XAMPP because of PHP 7. I am also using mysql workbench. I want to be as close to production as I can, but my webhoster supports only mysql. These where my reasons to switch back from mariadb to mysql
I followed these steps: (also max 5min)
https://gist.github.com/odan/c799417460470c3776ffa8adce57eece
From a Linux server I perform a dump of my database.
mysqldump -u root -p database_from_linux >database_from_linux.sql
And I create the new database on a Windows server from this dump:
mysql -u root -p database < database_from_linux.sql
On the Windows server, all tables name are in lowercase, whereas in linux server they are in uppercase.
In the SQL script, the tables names are in lower case.
How can i keep the uppercase in the Windows server database?
Server Linux 14.10
Mysql 5.5.40-ubuntu01
Mysql workbench 6.1
Server Windows 2012
Mysql 5.5.47
Mysql workbench 6.3
Thanks.
According to mysql docs you can set lower_case_table_names=0 on linux and lower_case_table_names=2 on windows. This will preserve case but you also have to specify correct case when writing queries.
I would argue that it's better to set lower_case_table_names=1 everywhere. You can still type queries using any case but internally it's converted to lowercase.
I just installed mysql 5.6 in a new CentOS 7 linux installation. I want to use the mysql command line client that I have been used to using in windows, but I cannot seem to find it. Is there a mysql command line client for linux? If so, how do I make sure that I have it? And how do I open it up in the GUI?
You can open MySql command line utility using following command
mysql -u user_name -p
It will ask for password for user_name. If password is not set call as follows
mysql -u user_name
First make sure the service is running :
sudo systemctl start mysqld
Then make sure to run the security script that will remove some dangerous defaults and lock down access to our database system a little bit.
sudo mysql_secure_installation
Now you can use the command line tool
mysql --user=user_name --password=your_password db_name
NOTE: The full discussion to the answer in this question is in a chat link in the comment section below, above the submitted answers.
The summarized answer is in checked answer.
After meddling with installing the gem for mysql2 and successfully doing that I type
which mysql
and it returns
mysql: aliased to nocorrect mysql
I'm not sure what this means.
Then I type in
mysql --version
and it outputs
mysql Ver 14.14 Distrib 5.5.20, for osx10.7 (i386) using readline 5.1
So I know mysql is installed.
Finally I want to configure a database for my rails app so, from within the correct directory I type:
mysql -u root -p
It asks me for a password and, since there is none, I leave it blank. It outputs this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I've been reading around for a solution but I don't understand any of them. Like finding a file called my.cnf or a folder called etc within the rails framework files...
It's trying to connect over unix sockets instead of tcp/ip. Try adding -h param eg
mysql -h localhost -u root -p
edit: Just read your question a bit closer. "mysql" being installed just means you have a client, not the server itself. Check you have mysqld installed.
mysql --socket=/var/lib/mysql/mysql.sock -u root -p
also read this
Here is what finally allowed me to create a freaking database in my rails apps through terminal after dealing this error.
I downloaded mysql's .dmg 64 bit version from here:
http://dev.mysql.com/downloads/mysql/
and then I followed the instructions in the README file. That was the most important part.
Thanks for the help everyone.
EDIT:
This didn't answer the question entirely for me since mysql stopped working.
After installing .dmg version I had to update the bash_profile file.
Here is where the instructions are:
Should I reinstall Mysql?
i cannot get mysql workbench 5.2 to work. i have mamp and mamp pro installed and running and no matter what type of connection i try it just wont connect. what can i do?
i have a mac with snow leopard
In MySQL workbench use Connection Method: Local Connection/Pipe and in the setting Socket/Pipe path enter: /Applications/MAMP/tmp/mysql/mysql.sock then enter your root username/password.
There are two tasks that need to be fixed to get MySQL Workbench working with a MAMP installation:
1) The Start/Stop/Status commands for the MySql server need to changed from the Server Instance configuration to the following:
Set the Start MySQL command to:
/Applications/MAMP/bin/startMysql.sh
Set the Stop MySQL command to:
/Applications/MAMP/bin/startMysql.sh
Set the Check MySQL Status command to:
ps xa | grep "/Applications/MAMP/Library/bin/[m]ysqld"
2) The my.cnf file needs to be created manually and the appropriate permissions given through a terminal window:
Utilities -> Terminal
sudo touch /etc/my.cnf
sudo chown joeb /etc/my.cnf
Changed joeb with your username.
If you want a more detailed guide, see MAMP, MySQL Workbench, WordPress installation and setup guide for MAC.
I follwed these instructions and got it to work: http://chrischarlton.us/tip/using-mysql-workbench-mamp-pro