Adding data sources for unixODBC/isql on Mac OSX Lion - mysql

I have installed unixODBC from source and mysql-odbc connector from .dmg installer on Mac OSX Lion. This was done a while ago, and at that time I successfully installed a data source (let's call it foo). Now I am trying to add another data source (DSN). I've done this through both ODBC Manager and the command-line tool myodbc-installer given with the tar bundle of the mysql-odbc connector from the mysql website. An entry shows up in /Library/ODBC/odbc.ini, which looks like this:
[ODBC Data Sources]
bar = MySQL ODBC 5.1 Driver
[ODBC]
Trace = 0
TraceAutoStop = 0
TraceFile =
TraceLibrary =
[myodbc]
Driver = /usr/local/lib/libmyodbc5.so
SERVER = localhost
PORT = 3306
[bar]
Driver = /usr/local/lib/libmyodbc5.so
Description =
DATABASE = bar
However, isql fails to find it:
anitya:Preferences neil$ isql bar bar bar -v
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
Weird thing is, the old DSN foo, which is not to be seen in /Library/ODBC/odbc.ini or /etc/odbc.ini, works fine:
anitya:Preferences neil$ isql foo foo foo
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
I'm miffed about where the DSN entries need to be entered on OSX Lion to be found by isql. Thanks in advance for your help!

Found it, odbc.ini was in /usr/local/etc

Related

Could not link driver rlm_sql_mysql

I have a problem with MySQL:
freeradius -X gives the following command:
Could not link driver rlm_sql_mysql: /usr/lib/freeradius/rlm_sql_mysql.so: cannot open shared object file: No such file or directory
Make sure it (and all its dependent libraries!) are in the search path of your system's ld
/etc/freeradius/3.0/mods-enabled/sql[18]: Instantiation failed for module "sql
"
admin#ubuntu-de-01:/etc/freeradius/3.0/mods-available$ freeradius -v
radiusd: FreeRADIUS Version 3.0.16, for host x86_64-pc-linux-gnu, built on Apr 17 2019 at 12:59:55
FreeRADIUS Version 3.0.16
Copyright (C) 1999-2017 The FreeRADIUS server project and contributors
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE
You may redistribute copies of FreeRADIUS under the terms of the
GNU General Public License
For more information about these matters, see the file named COPYRIGHT
The MySQL database is working:
Database changed
mysql> show tables;
+------------------+
| Tables_in_radius |
+------------------+
| nas |
| radacct |
| radcheck |
| radgroupcheck |
| radgroupreply |
| radpostauth |
| radreply |
| radusergroup |
+------------------+
8 rows in set (0.00 sec)
mysql>
I haven't tried installing libmysqlclient or yum or anything.
This problem started occurring after I've reinstalled the freeradius.
Is there a requirment to reinstall the mysql DB somehow as well?
Thank you
in my case, after downgrading the MySQL version, the libmysqlclient-dev library was missed, all that was needed was just to install it.
apt install libmysqlclient-dev
Hope, this helps someone.

Rails and mysql use different DB while using the same connection string

I used to have mySQL installed in my Rails app and everything was good until I had to install MariaDB (because Sphinx is not compatible with mysql 8).
After deleting the database and recreating it, my I getting this:
rails db:create
Database 'xxx_dev' already exists
Database 'db/test.sqlite3' already exists
but if I start mysql I get this:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.3.13-MariaDB Homebrew
.....
MariaDB [(none)]> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
My Rails app connects to the db using sockets. Apparently, they are not using the same MySql instance (I brew uninstalled everything but MariaDB).

MySQL User Permission Errors using Sqitch on Ubtunu

I am running into what I think is a very easy issue to fix, I am just out of possible ideas.
I have a brand new Ubuntu 14.04 x64 server. I just installed MySQL. Not Apache, php or phpMyAdmin, just plain MySQL.
I have run through mysql_secure_installation and created a password for my root user.
I then put my root password in the /etc/mysql/my.cnf file under the [client] section.
I can run mysql -u root and get to the MySQL console just fine.
However, if I run sqitch deploy I get:
Access denied for user 'root'#'localhost' (using password: NO)
Sqitch is pointing to:
[target "database name_v1"]
uri = db:mysql://root#/databasename_v1
[engine "mysql"]
target = db:mysql://root#/databasename_v1
EDIT
It turns out the problem was with Sqitch and my configuration. Sqitch is a Perl application and needed the perl module MySQL Config in order to read the my.cnf file and access the database.
It turns out the problem was with Sqitch and my configuration. Sqitch is a Perl application and needed the perl module MySQL::Config in order to read the my.cnf file and access the database.
If you are using -v to get MySQL version, here's your answer : mysql -V
-v is for verbose output.
See this thread for more details.
"mysql -v" command line error(linux/ubuntu)
There are multiple root users in mysql. They are in the format user#remote.
You can check if the user password is set for all of those by running the query select Host, User, Password from mysql.user where User="root";
The output should show something like:
+--------------+----------+-------------------------------------------+
| Host | User | Password |
+--------------+----------+-------------------------------------------+
| localhost | root | *XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| testvm | root | *XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 127.0.0.1 | root | *XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
If the password is empty, set it via mysqladmin.
From here on, your connection to mysql, whether coming from localhost, or coming from the hostname will be allowed to login.

Cannot connect to mysql server with MAMP nor with Community Server

I created a database with MySQL Workbench, and now I need to access it. So I've written a php script to access it:
<?
$db = mysql_connect("127.0.0.1:3306","root", "");
if (!$db){
echo "Could not connect to database";
exit();
}
$db_name = "pfc_db";
if (!mysql_select_db($db_name, $db)){
die ("Could not select database");
}
$sql=mysql_query("select * from CAPAS");
while($row=mysql_fetch_assoc($sql)){
$output[]=$row;
if (isset($output)){
echo "yes";
echo $output[0];
}
else{echo "no";}
}
mysql_close();
?>
I have doubts about MAMP and MySQL Community Server and I need a push on the right path.
I've installed MAMP on my mac and switched the ports to the default mysql ones 3306. I've placed the PHP test script in a folder "Api" I've created under htdocs. So to try it out i type on my browser http://127.0.0.1/api/test.php and the result is "Could not connect to databse". Am I doing it right?
And what about Community Server? Is it better than MAMP? Should it be running for MAMP to work? Can I just use Community Server? If so, where should I place the PHP scripts? Which folder? Because when I try to do the same test with Community Server, instead of showing the error message, the browser starts downloading the php script to my downloads folder. Why happens that?
As you can see I have a bit of a mess in my mind with these server stuff and I need some help to figure it out.
You do not need to install MySQL Community Server. MAMP already comes with MySQL.
You need to ouput more specific errors within your code by using the mysql_error() function.
if (!$db){
echo "Could not connect to database" . mysql_error();
exit();
}
$db_name = "pfc_db";
if (!mysql_select_db($db_name, $db)){
die ("Could not select database" . mysql_error());
}
mysql_error will return the error message(s) from MySQL.
Following the asnwer I was giving to user775263, i get this table of users:
+
--------------------+------+----------+
| Host | User | Password |
+--------------------+------+----------+
| localhost | root | |
| SquirrellJoe.local | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| SquirrellJoe.local | | |
+--------------------+------+----------+
As you can see, any of the users has any password set. But then I found out there's a config.inc.php script under bin/phpmyadmin where there are these sentences:
$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = 'root'; // MySQL password (only needed
I tried again to connect with $db = mysql_connect("127.0.0.1:3306","root", "root"); and the connexion was successful. Why the users table in mysql command line doesn't reflect this? Is it normal? Should I change it?
And then I run into another problem. It can't select the database 'pfc_db' I created on MySQL Workbench. I get the error message Unknown database 'pfc_db'. However, when I type mysql> show databases; the mentioned db does appear on the table:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| pfc_db |
| test |
+--------------------+
So what might be the problem here?
Well, I'm gonna answer myself so that if someone runs into the same problem.
The error of password happened because I had two installations of mysql in the same computer, so that I was checking the passwords in one of them and the browser was looking at the other.
Therefore, if you have problems with password access, check that you don't have two mysql installed and also check the file config.inc.php
I also changed TCP/IP by a socket connexion, which improves the speed if you're using your localhost as server.
This worked for me
sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
I ran into this problem and fixed it by using the default TCP/IP port instead of the socket port.
So in my case instead of 3306, I used 8889
$db = mysql_connect("127.0.0.1:8889","root", "");

Unable to get multiple connection to MySql on Windows 7

I have installed MySql on windows 7 ... issue is i'm unable to get multiple connection to MySql .
If I connect to MySql through command line and at the same time open an other MySql command line client it goes into wait state, as soon as I disconnect the first one later one gets connected.
Because of above issues I'm unable to run tomcat in debug mode as it tries to get more than one connection to MySql in debug mode.
Previously I was using same version of MySql i.e. 5.1 on vista and it was working fine.
when connected with only one MySql Command line "show processlist" results
| 4 | root | localhost:49487 | NULL | Query | 0 | NULL | show processlist
1 row in set (0.00 sec)
and after connnecting with 2nd command line which hangs "show processlist" on the 1st window results
| 4 | root | localhost:49487 | NULL | Query | 0 | NULL | show processlist
| 5 | root | localhost:49518 | NULL | Sleep | 0 | NULL | NULL
2 rows in set (0.00 sec)
I entered following command through command line.
mysql -u root -h localhost -P 3306 -p
it asked me for password and got connected. Then I opened an other command prompt entered the same command it asked for password and hanged. I went back to the previous command line and closed it and the current one got connected. max_connection is 100 in my.ini file and show processlist reutns same result as above.
What is your 'max_connections' setting (show variables like '%max_connections%') and how many connections are currently 'live' on the server (show processlist)?
I'm guessing it's set very low (1 or 2) and between tomcat and your monitor connections you're exceeding the limit.
Raising it would be done via the mysql.ini/mysql.cnf file, wherever it's kept on Windows.
Are you connecting over the network? or a local file socket? You may be locking on the windows equivalent of mysql.sock - not sure if that behavior changed in Win7. Something like:
mysql -u root -h localhost -p 3306
and make sure that my.ini/my.cnf have networking enabled
After too many re installation of Windows I guess i have identified the root cause ... On every fresh installation MySql use to work fine but after a while I use to get stuck with this issue.
The cause was my voip messenger "Wizton" after installing it MySql work fine but when i restart my machine ... same Connection issue.
But wizton was working perfectly fine with Vista Business .. don't no what happens in Windows 7.