C Programming fatal error my sql.h no file or such directory on code blocks - mysql

I'm unable to use mysql on C when I do #include <mysql.h> or #include "mysql.h". Every time I try to run this program, I get a fatal error.
I put these as my linker settings to add the sql library :
C:\Program Files\MySQL\Connector C++ 8.0\libmysqlclient.so
C:\Program Files\MySQL\MySQL Server 8.0
also this is my search directories:
C:\Program Files\MySQL\Connector C++ 8.0
C:\Program Files\MySQL\MySQL Server 8.0
Any idea how to make codeblocks work with this?
Thanks and I'll keep searching too.

In looking for the answer, I found it. So instead of doing what I did in the link and search directories, instead do this:
Linker settings:
"C:\Program Files\MySQL\MySQL Server 8.0\lib\libmysql.lib"
"C:\Program Files\MySQL\MySQL Server 8.0\lib\mysqlclient.lib"
Search Directores:
"C:\Program Files\MySQL\MySQL Server 8.0\lib"
"C:\Program Files\MySQL\MySQL Server 8.0\include"
This allowed me to compile the code with no errors

Related

Apply failed: Couldn't copy file "C:\Program Files\IDA Pro 8.0\python\3\PyQt5\python_3.9\sip.pyd

When I run idapyswitch.exe, I encounter this information
Checking installs from "Python Software Foundation"
Checking "Python 3.10 (64-bit)" (3.10)
Found: "C:\Program Files\Python310\" (version: 3.10.5 ('3.10.5150.1013'))
Checking "Python 3.9 (64-bit)" (3.9)
Found: "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\" (version: 3.9.7 ('3.9.7150.1013'))
Checking "Python 3.10" (3.10)
Found: "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0" (version: 3.10.10 ('3.10.10150.1013'))
Ignoring unusable AppStore Python "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\python3.dll"
IDA previously used: "C:\Program Files\Python310\python310.dll" (guessed version: 3.10.5 ('3.10.5150.1013')). Making this the preferred version.
The following Python installations were found:
#0: 3.10.5 ('3.10.5150.1013') (C:\Program Files\Python310\python3.dll)
#1: 3.9.7 ('3.9.7150.1013') (C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python3.dll)
Please pick a number between 0 and 1 (default: 0)
1
Applying version 3.9.7 ('3.9.7150.1013')`
and it said permission denied
Apply failed: Couldn't copy file "C:\Program Files\IDA Pro 8.0\python\3\PyQt5\python_3.9\sip.pyd" to "C:\Program Files\IDA Pro 8.0\python\3\PyQt5\sip.pyd": Permission denied
I'm using IDA 8.0 and Python 3.10.10
I have pick number 0 and it still prompt the same error. How can i fix this

How can I set the my.ini location at install time

I have an application with a NSIS installer, it installs my application and also mysql 5.7.25.
When installing it create a my.ini inside :
C:\ProgramData\MySQL\MySQL Server 5.7
The problem is that one of my client has another application which run with mysql 5.7.20. which also has a my.ini in the same place. So my installer overwrite the existing file and break the other app.
When installing how can I tell the installer where the my.ini is ?
My idea is to put it inside my application folder and tell mysql to look here:
C:\ProgramData\MyAPP
I am installing mysql like that (in 2 steps):
I install the installer :
"msiexec" /quiet /norestart /i
"C:\MYAPP\Mysql\mysql-installer-community-5.7.25.0.msi"
INSTALLDIR="C:\Program Files\MySQL\MySQL Server 5.7"
then mysql
"C:\Program Files (x86)\MySQL\MySQL Installer for
Windows\MySQLInstallerConsole.exe" community install -silent
server;5.7.25;x64:*:port=3306;passwd=root;installdir="C:\Program
Files\MySQL\MySQL Server 5.7"
Thanks
Ok I found the solution :
I believed that mysql installation was creating the service. But I was wrong the windows service is created later in my installer :
'"$1\bin\mysqld.exe" --install ${MYSQL_SERVICE_64}'
So can add the argument "--defaults-file" here and place the .ini where ever I want.

Running mysql_ssl_rsa_setup generates an error

In Windows Server 2008, I was running the program with following command:
E:\Program Files\MySQL\MySQL Server 5.7\bin>mysql_ssl_rsa_setup --datadir="E:\Program Files\MySQL\MySQL Server 5.7\SSL"
It returns this error:
Unable to load config info from "C:\Program Files (x86)\Common Files\ibm\icc\cimom\bin\openssl.cnf"
2018-01-17 10:45:51 [ERROR] Error generating ca_key.pem and ca_req.pem
The user account has full control to the path. Please help out.

Permanently enable ONLY_FULL_GROUP_BY in Windows

I'm running mysql 5.7.17 on Windows 7 and I've found its configuration to be different than when I run from the docker image. More specifically, the docker image adds the ONLY_FULL_GROUP_BY mode, which the windows installation doesn't by default. I would like to add it in windows too (permanently, not just for the session). I've tried with this options:
[mysqld]
sql_mode="NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,ONLY_FULL_GROUP_BY"
and
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,ONLY_FULL_GROUP_BY
In C:\Program Files\MySQL\MySQL Server 5.7\my-default.ini (that's the only file the installation creates, but it is told in the comments not to edit it), C:\Program Files\MySQL\MySQL Server 5.7\my.ini and C:\Windows\my.ini. When I execute mysql --help I get this output:
Default options are read from the following files in the given order:
C:\windows\my.ini C:\windows\my.cnf C:\my.ini C:\my.cnf C:\Program
Files\MySQL\M ySQL Server 5.7\my.ini C:\Program Files\MySQL\MySQL
Server 5.7\my.cnf
I've got nothing related in C:\.
But the server seems not to pick the sql mode. When I query for SELECT ##sql_mode and SELECT ##global.sql_mode I only get STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION.
From the Mysql docs:
On Windows, MySQL Installer interacts with the user and creates a file named my.ini in the base installation directory as the default option file. If you install on Windows from a Zip archive, you can copy the my-default.ini template file in the base installation directory to my.ini and use the latter as the default option file.
But again, I only got my-default.ini created.

reset root mysql on windows

Following the recommended instructions for resetting root at link and the other recommendations here at stackoverflow. I tried to reset my root pass both ways suggested, with and without the --defaults-file option
First I tried.
"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" –init-file=C:\\mysql-init.txt --console
Error:
C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld: Too many arguments (first extra is 'ûinit-file=C:\mysql-init.txt').
Next I tried
"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 5.5\\my.ini" MySQL55 –init-file=C:\\mysql-init.txt --console
Error:
C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld: Too many arguments (first ex
tra is 'MySQL55').
'Too many arguments' makes me think my syntax is the problem
Look at your command lines again and manually delete the LONG HYPHENS. Then type the hyphens in again manually.
"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" –init-file=C:\mysql-init.txt --console
should be
"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --init-file=C:\mysql-init.txt --console
(notice the hyphens before init-file)
Refer to mysqld options
I uninstalled the MySQL server.
I went to the mysql folder, and erased everything (the folder too).
Reboot the PC.
Reinstall the MySQL.
Set the new password.