MariaDB opens instead of MySQL in cmd prompt - mysql

I have been using XAMPP for MySQL which works fine when I am using in browser but if I open MySQL in command-line it opens MariaDB instead of MySQL. Let me know the reason soon.

Looks like Xamp now ships with MariaDB. Check out this article for more information
https://www.apachefriends.org/blog/new_xampp_20151019.html
The MYSQL apache extension works with MariaDB so although it seems apache is using MYSQL i think it is connecting to your MariaDB server.
I wouldn't worry too much. MariaDB runs and works almost identical to MYSQL. What sort of concerns do you have running MariaDB?
If it is an issue have a look at installing and older version of Xamp that contains MYSQL eg
https://sourceforge.net/projects/xampp/

I know it's too late to respond the question , but I also have same problem and you can use either of these options
mysql -u user_name -h host_name mysql -p
replace user_name and host_name with yours
mysql -u user_name -h host_name -p
Then enter
Use mysql;
And that will do it.

That's fine. Try running table fetching commands & it will work fine.
Like "use tablename"
"show table" etc & it will fetch data from MySQL database only

Related

Configuring MySQL's mysqlsh to accept SQL and connect by default

How do I configure the MySQL 8.0.15 shell. I just downloaded it and I am already having problems.
When I run the shell program I always have to switch from MySQL JS to MySQL SQL
I always have to reconnect using \connect root#localhost
I would like to open the MySQL shell and just get to work without having to do those two things.
If you start the shell with mysqlsh --sql --uri=myname#localhost it will accept SQL commands directly.
If you need only to use SQL you may wish to consider using the ancient and honorable mysql command line client program. mysql -h localhost -u myname

mysql from windows cmd opens old version

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

MySQL Syntax Error (Ubuntu LAMP Server)

Alright, so I've got a fairly fresh Ubuntu (server) installation. Just finished installing the LAMP server and when I go to create a database I'm getting the generic syntax error (1064 / 42000).
My query:
CREATE DATABASE phpbb;
Pretty simple and pretty standard, so I'm not sure what the issue is. Any ideas?
It looks from your error like you're trying to execute SQL on the command line, something like:
mysql -u mike -p CREATE DATABASE phpbb';
MySQL isn't going to like that, it separates the initiation of the tool from the SQL commands.
What I'd normally do for CREATE DATABASE, as it's a one off, I'd do it manually.
So start the tool with
mysql -u mike -p
This should prompt you for your password, and connect to the local database, giving you a shell prompt:
mysql>
You then issue your
CREATE DATABASE phpbb;
If you want to run scripts from the command line, put them in a file and redirect the input to mysql. Usually you'd redirect the output too - something like this:
mysql -u mike -p < mysqlscript.sql > outputofscript.log

mysql workbench ssh custo command

I'm trying to configure a new connection through SSH tunnel.
But on the server, the command mysql does not exists. I have my own compilation called custo-mysql.
I mean, when I'm on the server, I use the following command :
$ custo-mysql -u root -pmypassword
How can I tell workbench to use custo-mysql and not mysql ?
mysql (and your custo-mysql) is a client for the server. Workbench is a client as well, so it doesn't need to use that custo-mysql thing. It just connects to your server.
Basically, on your server you have a "mysqld" running: a mysql server. Your commans custo-mysql connects to that server as a sort of interface. Workbench has the exact same function, so it should work if your networking/tunneling etc is correct.
As #Nanne already mentioned, you don't need the mysql client to connect to your MySQL server using Workbench.
I would just like to point out that Workbench does use the mysql command line client for importing databases in the Admin / Data Import/Restore section. Having said that, you'll certainly be OK without it for everything else.
Cheers,

How to delete mysql db rows remotely?

Can I run mysql delete row remotely from other machine?
Something alike mysqldump which run locally dumping data on other remote machine.
try:
mysql -u yourdblogin -pyourdbpassword -h yourdbdomain.yourdomain.com yourdb -e "delete from table where x = y"
not sure if -e is the correct argument, but the though is sound.
Only if you have TCP connections configured on the MySQL server, and you have a username and password configured that will allow you to remotely connect.
If you check the mysqldump documentation, you'll find the -host option allows you to connect to a remote system.
You can try something like this:
mysql -u yourdblogin -pyourdbpassword -h yourdbdomain.yourdomain.com yourdb
Sorry if I misunderstood your question.
The specific way of doing this is to connect to the remote machine using the mysql prompt and then execute queries against it (queries which cause a row to be deleted.)
# mysql -u username -p -h remote.location.com
mysql> USE `database_name`;
mysql> DELETE FROM `table` WHERE id=1234;
The DELETE FROM syntax is SQL syntax, and the WHERE part of it allows you to specific exactly what you want to be deleted.
Also, you most likely won't be able to log in as 'root' if you're used to doing so, as root by default can't connect remotely. (You can enable this, but it's recommended instead to make another admin account and to use that instead).
Note that code may also remotely delete rows, however it depends on the language and implementation as to how it's done.
References:
MySQL DELETE Syntax
MySQL SELECT Syntax (includes details about WHERE)
You can actually use any MySQL client application to connect to remote servers, not only the supplied command-line tool.
If the server allows TCP client connections, there are no differences between running scripts locally or remotely.
If the MySQL server happens to be also a web server, you can use a software like PHPMyAdmin to do it. Once it runs locally (on the same machine as the MySQL server, not your machine), you can work around the problem of not accepting external TCP connections, if the server was configured that way.