Mysql 8.0.3: function regexp_replace does not exist - mysql-8.0

New project uses regexp_replace, so i updated mysql installation to 8.0.3. But still feeling like nothing changed =)
Trivial query:
$ echo "select regexp_replace('a','.','z')" | mysql mysql
ERROR 1305 (42000) at line 1: FUNCTION mysql.regexp_replace does not exist
Version:
$ # mysqld --version
/usr/sbin/mysqld Ver 8.0.3-rc-log for Linux on x86_64 (MySQL Community Server (GPL))

REGEXP_REPLACE function was released in version 8.0.4, so updating to 8.0.12 solved the problem.

Related

How to downgrade JDK/javac - MacOS

I am trying to downgrade the jdk for a project I'm running from 17.0.5 to 1.8, but have not been able to replicate any of the results I've found online. Specs and attempts below.
Specs:
MacOS Big Sur v11.6.8
Java v1.8.0_351
Javac v17.0.5
Gradle v7.6
Homebrew v3.6.16
Running /usr/libexec/java_home -V:
Matching Java Virtual Machines (4):
17.0.5 (x86_64) "Oracle Corporation" - "Java SE 17.0.5" /Library/Java/JavaVirtualMachines/jdk-17.0.5.jdk/Contents/Home
1.8.351.10 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_351 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_351.jdk/Contents/Home
1.8.0_341 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_341.jdk/Contents/Home
First, I tried replicating the code from this answer regarding downgrading java:
https://stackoverflow.com/a/48422257/20834861
I quickly realized that the bash profile from sudo nano was already used to downgrade java to v1.8.
Then, I tried this solution: https://stackoverflow.com/a/23819062/20834861
But sudo mv jdk1.8.0_351.jdk ~/Desktop/ returns the following error: mv: rename jdk1.8.0_351.jdk to /Users/sahil/Desktop/jdk1.8.0_351.jdk: No such file or directory
So next, I tried the solution from this link:
https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/#java-home-and-macos-11-big-sur
When I tried the final line of code, echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_351.jdk/Contents/Home , I received the following error: zsh: permission denied: /Library/Java/JavaVirtualMachines/jdk1.8.0_351.jdk/Contents/Home .
Finally, I tried a similar line of code but with source as the bash_file instead of zshenv. I got the same error.
I must be missing something really obvious but I could not find anything else on the internet. Any help is appreciated.
With OSX you can select which jdk to use by using the JAVA_HOME environment variable. To set it.
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_351.jdk/Contents/Home
That should work because it is in the list of jdk's you have available according to java_home. You can also use the java_home command to get the appropriate jdk.
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Then when you run java or javac it should be from the version selected.

Oracle Instant Client still not working on Mac OS Catalina 10.15.4

I installed the Oracle Instant Client version 19.3 on my Mac Os Catalina version 10.15.4
But i still have the same error on python3.7 and python3.8:
Origin: (cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1): no suitable image found. Did find:
file system relative paths not allowed in hardened programs". See https://oracle.github.io/odpi/doc/installation.html#macos for help
(Background on this error at: http://sqlalche.me/e/4xp6)
here is my installation:
$: ls-l ~/lib
ls -l ~/lib
total 0
lrwxr-xr-x 1 giacomocallegaro staff 58 22 Apr 09:13 libclntsh.dylib -> /Users/giacomocallegaro/instantclient_19_3/libclntsh.dylib
$: cat .zprofile
Setting PATH for Python 3.8
The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
Setting PATH for Python 3.7
The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH=$PATH:~/instantclient_19_3
export PATH
$: echo $PATH
/Users/giacomocallegaro/.nvm/versions/node/v12.14.1/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/giacomocallegaro/.nvm/versions/node/v12.16.1/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/opt/openssl/bin:/Users/giacomocallegaro/instantclient_19_3:/Users/giacomocallegaro/instantclient_19_3
$: which python:
/usr/bin/python
when I run sqlplus:
$: sqlplus -v
SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Can some one help me please?
Go to https://www.oracle.com/technical-resources/
Downloads --> Oracle Instant Client --> macOS(Intel x86) --> Basic Package
In your download folder you will find a folder named instantclient_19_3
Add the following to your python script
import cx_Oracle
cx_Oracle.init_oracle_client(lib_dir=r'/Users/<username>/Downloads/instantclient_19_3')
Some windows will pop up, so go to System preferences --> Security & Privacy --> General and there you will see a notification. Click on open anyway. You will have to repeat this last step 3-4 times.
After you download instant client from here, create a symbolic link into /usr/local/lib folder (that's where all .dylib files keep their symbolic links).
In my case, I extracted instant client into /opt/oracle/instantclient_19_3. So the command is:
$ ln -s /opt/oracle/instantclient_19_3/libclntsh.dylib /usr/local/lib/
However, there is another problem when I try to create the connection from python:
Error while trying to retrieve text for error ORA-01804
Oracle says: "Instant Client 19.3 and 18.1 support macOS Mojave and High Sierra", and I have macOS Catalina 10.15, don't know if this has anything to do with that, error 01804 says that timezone information is invalid.
More info on this: http://www.dba-oracle.com/t_ora_01804_start_oracle.htm
EDIT: issue resolved.
After downloading the SQL*Plus Package I managed to connect and verify the instant client works. My python issue was also resolved when I restarted IntelliJ (I was running the server from within so the PATH might have not been updated).
Maybe the error is misleading and it is related to general issue with Oracle Instant Client on MacOS Catalina? Have a look at this blog post:
Gary's Oracle On Tap
Hope this helps!

Oracle 11g on centos 7 ldconfig issue

After installing oracle 11g and adding its libraries to /etc/ld.so.conf.d I've run into
dbus-daemon: /usr/bin/dbus-daemon: symbol lookup error: /usr/bin/dbus-daemon: undefined symbol: XML_SetHashSalt
and the system locked out.
Solved by removing libexpat.so* from oracle libraries.

Unable to create spatial database for geodjango on Mac OS X

I am trying to install PostGIS for MacOS X and uptil now this is what i got
PostGIS is now configured for x86_64-apple-darwin10.8.0
-------------- Compiler Info -------------
C compiler: gcc -g -O2
C++ compiler: g++ -g -O2
-------------- Dependencies --------------
GEOS config: /usr/local/bin/geos-config
GEOS version: 3.3.3
PostgreSQL config: /usr/local/pgsql/bin/pg_config
PostgreSQL version: PostgreSQL 9.1.3
PROJ4 version: 48
Libxml2 config: /usr/bin/xml2-config
Libxml2 version: 2.7.3
JSON-C support: yes
PostGIS debug level: 0
Perl: /usr/bin/perl
--------------- Extensions ---------------
PostGIS Raster: disabled
PostGIS Topology: enabled
-------- Documentation Generation --------
xsltproc: /usr/bin/xsltproc
xsl style sheets:
dblatex:
convert:
mathml2.dtd: http://www.w3.org/Math/DTD/mathml2/mathml2.dtd
Does this mean that PostGIS is now installed? Why is the PostGIS Raster disabled?
Also when i follow the tutorial I am getting this error
createdb -E UTF8 template_postgis
createdb: could not connect to database postgres: FATAL: role "root" does not exist
Then i checked for the command
sudo su - postgres
and it returns 1 for echo $?
This means that PostGIS is configured, as the first line says.
Typically you proceed with make and make install. After this is done you'll have PostGIS libraries ready, but you'll have to create PostGIS support functions on the database level, something like this: psql -c spatial_ref_sys.sql
I would recommend consulting also the official docs.
Your error message means that you're trying to connect to the database with the user / to the database that doesn't exists there. By default, PostgreSQL tools will try username / database that match your current unix user, which seems to be root.
And keep in mind that it is a very bad practice to work under root account.

Zend Framework: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'

As you may have known that I switched from ubuntu to windows from my previous questions. I was working on Zend Framework on ubuntu and now working on same project in windows. Because of this switching I am facing some problems in windows which was not occurred in ubuntu.
Now I have the following error in firebug console when I go to login page:
<b>Fatal error</b>: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in <b>C:\wamp\www\vcred\library\Zend\Db\Adapter\Pdo\Mysql.php</b> on line <b>93</b><br />
Do you people know that what type of error is this and what is the solution?
I have the following configuration for database.
resources.db.adapter = "Pdo_Mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = ""
resources.db.params.dbname = "test"
resources.db.params.charset = "utf8"
Thanks
I just had the same error with PHP 5.2.6, and all I had to do is to open php.ini (e.g. on Windows: C:\Windows\php.ini, or on Ubuntu: /etc/php5/apache2/php.ini or sg. like this) in a text editor, and remove the semicolon from the following line:
;extension=php_pdo_mysql.dll
So as a result it would look like this in php.ini:
extension=php_pdo_mysql.dll
That solved my problem.
This looks related to this bug on PHP's bugtracker : Bug #47224 MYSQL_ATTR_INIT_COMMAND is no longer available
It seems it's been fixed in SVN -- but maybe not in the version of PHP you are using ?
Quoting one of the comments :
[2009-07-02 06:43 UTC] mg at artigo
dot pl A temporary solution is to
use INT value (1002) instead of
constant.
This might be a temporary solution, until you install a new version of PHP, in which the bug is fixed ?
Looks like a Windows bug in PHP 5.3 that was fixed in SVN a while ago. You might want to try updating to the latest PHP release to see if the issue still exists.
I got the same error, on debian6, when I had not yet installed php-mysql so, I simply installed this, like this
apt-get install php5-mysql
/etc/init.d/apache2 restart
I just add it here, in case other have same problem, to save them them a few minutes of research.

Resources