Somebody asked me how to expand a prior example with the static variables so that it took arguments at the command line for the variables. This example uses Python 3 new features in the datetime
package.
There’s a small trick converting the string
arguments to date
data types. Here’s a quick example that shows you how to convert the argument list into individual date
data type variables:
#!/usr/bin/python3
# include standard modules
import sys
from datetime import datetime
# Capture argument list.
fullCmdArguments = sys.argv
# Assignable variables.
beginDate = ""
endDate = ""
# Assign argument list to variable.
argumentList = fullCmdArguments[1:]
# Enumerate through the argument list where beginDate precedes endDate as strings.
try:
for i, s in enumerate(argumentList):
if (i == 0):
beginDate = datetime.date(datetime.fromisoformat(s))
elif (i == 1):
endDate = datetime.date(datetime.fromisoformat(s))
except ValueError:
print("One of the first two arguments is not a valid date (YYYY-MM-DD).")
# Print the processed values and types.
print("Begin Date: [",beginDate,"][",type(beginDate),"]")
print("End Date: [",endDate,"][",type(endDate),"]") |
#!/usr/bin/python3
# include standard modules
import sys
from datetime import datetime
# Capture argument list.
fullCmdArguments = sys.argv
# Assignable variables.
beginDate = ""
endDate = ""
# Assign argument list to variable.
argumentList = fullCmdArguments[1:]
# Enumerate through the argument list where beginDate precedes endDate as strings.
try:
for i, s in enumerate(argumentList):
if (i == 0):
beginDate = datetime.date(datetime.fromisoformat(s))
elif (i == 1):
endDate = datetime.date(datetime.fromisoformat(s))
except ValueError:
print("One of the first two arguments is not a valid date (YYYY-MM-DD).")
# Print the processed values and types.
print("Begin Date: [",beginDate,"][",type(beginDate),"]")
print("End Date: [",endDate,"][",type(endDate),"]")
Assume you call this arguments.py
. Then, you call it with valid conforming date format value like the following command-line example:
./arguments.py 2001-01-01 2003-12-31 |
./arguments.py 2001-01-01 2003-12-31
It returns the arguments after they have been converted to date
data types. The results should look like this:
Begin Date: 1991-01-01 [ <class 'datetime.date'> ]
End Date: 2004-12-31 [ <class 'datetime.date'> ] |
Begin Date: 1991-01-01 [ <class 'datetime.date'> ]
End Date: 2004-12-31 [ <class 'datetime.date'> ]
The next Python example accepts dynamic arguments at the command line to query the MySQL database:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
| #!/usr/bin/python3
# Import the library.
import sys
import mysql.connector
from datetime import datetime
from datetime import date
from mysql.connector import errorcode
# Capture argument list.
fullCmdArguments = sys.argv
# Assignable variables.
start_date = ""
end_date = ""
# Assign argument list to variable.
argumentList = fullCmdArguments[1:]
# Check and process argument list.
# ============================================================
# If there are less than two arguments provide default values.
# Else enumerate and convert strings to dates.
# ============================================================
if (len(argumentList) < 2):
# Set a default start date.
if (isinstance(start_date,str)):
start_date = date(1980, 1, 1)
# Set the default end date.
if (isinstance(end_date,str)):
end_date = datetime.date(datetime.today())
else:
# Enumerate through the argument list where beginDate precedes endDate as strings.
try:
for i, s in enumerate(argumentList):
if (i == 0):
start_date = datetime.date(datetime.fromisoformat(s))
elif (i == 1):
end_date = datetime.date(datetime.fromisoformat(s))
except ValueError:
print("One of the first two arguments is not a valid date (YYYY-MM-DD).")
# Attempt the query.
# ============================================================
# Use a try-catch block to manage the connection.
# ============================================================
try:
# Open connection.
cnx = mysql.connector.connect(user='student', password='student',
host='127.0.0.1',
database='studentdb')
# Create cursor.
cursor = cnx.cursor()
# Set the query statement.
query = ("SELECT CASE "
" WHEN item_subtitle IS NULL THEN item_title "
" ELSE CONCAT(item_title,': ',item_subtitle) "
" END AS title, "
"release_date "
"FROM item "
"WHERE release_date BETWEEN %s AND %s "
"ORDER BY item_title")
# Execute cursor.
cursor.execute(query, (start_date, end_date))
# Display the rows returned by the query.
for (item_name, release_date) in cursor:
print("{}, {:%d-%b-%Y}".format(item_name, release_date))
# Handle exception and close connection.
# ============================================================
except mysql.connector.Error as e:
if e.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif e.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print("Error code:", e.errno) # error number
print("SQLSTATE value:", e.sqlstate) # SQLSTATE value
print("Error message:", e.msg) # error message
# Close the connection when the try block completes.
finally:
cnx.close() |
#!/usr/bin/python3
# Import the library.
import sys
import mysql.connector
from datetime import datetime
from datetime import date
from mysql.connector import errorcode
# Capture argument list.
fullCmdArguments = sys.argv
# Assignable variables.
start_date = ""
end_date = ""
# Assign argument list to variable.
argumentList = fullCmdArguments[1:]
# Check and process argument list.
# ============================================================
# If there are less than two arguments provide default values.
# Else enumerate and convert strings to dates.
# ============================================================
if (len(argumentList) < 2):
# Set a default start date.
if (isinstance(start_date,str)):
start_date = date(1980, 1, 1)
# Set the default end date.
if (isinstance(end_date,str)):
end_date = datetime.date(datetime.today())
else:
# Enumerate through the argument list where beginDate precedes endDate as strings.
try:
for i, s in enumerate(argumentList):
if (i == 0):
start_date = datetime.date(datetime.fromisoformat(s))
elif (i == 1):
end_date = datetime.date(datetime.fromisoformat(s))
except ValueError:
print("One of the first two arguments is not a valid date (YYYY-MM-DD).")
# Attempt the query.
# ============================================================
# Use a try-catch block to manage the connection.
# ============================================================
try:
# Open connection.
cnx = mysql.connector.connect(user='student', password='student',
host='127.0.0.1',
database='studentdb')
# Create cursor.
cursor = cnx.cursor()
# Set the query statement.
query = ("SELECT CASE "
" WHEN item_subtitle IS NULL THEN item_title "
" ELSE CONCAT(item_title,': ',item_subtitle) "
" END AS title, "
"release_date "
"FROM item "
"WHERE release_date BETWEEN %s AND %s "
"ORDER BY item_title")
# Execute cursor.
cursor.execute(query, (start_date, end_date))
# Display the rows returned by the query.
for (item_name, release_date) in cursor:
print("{}, {:%d-%b-%Y}".format(item_name, release_date))
# Handle exception and close connection.
# ============================================================
except mysql.connector.Error as e:
if e.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif e.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print("Error code:", e.errno) # error number
print("SQLSTATE value:", e.sqlstate) # SQLSTATE value
print("Error message:", e.msg) # error message
# Close the connection when the try block completes.
finally:
cnx.close()
You can call the python-mysql-query.py
program with the following syntax:
./python-mysql-query.py 2001-01-01 2003-12-31 |
./python-mysql-query.py 2001-01-01 2003-12-31
It returns the films between 1 Jan 2001 and 31 Dec 2003, like this:
Clear and Present Danger: Special Collector's Edition, 06-May-2003
Die Another Day: 2-Disc Ultimate Version, 03-Jun-2003
Die Another Day, 03-Jun-2003
Die Another Day, 03-Jun-2003
Golden Eye, 03-Jun-2003
Golden Eye: Special Edition, 03-Jun-2003
Harry Potter and the Chamber of Secrets, 28-May-2002
Harry Potter and the Chamber of Secrets: Two-Disc Special Edition, 28-May-2002
Harry Potter and the Sorcerer's Stone, 28-May-2002
Harry Potter and the Sorcerer's Stone: Two-Disc Special Edition, 28-May-2002
Harry Potter and the Sorcerer's Stone: Full Screen Edition, 28-May-2002
MarioKart: Double Dash, 17-Nov-2003
Pirates of the Caribbean, 30-Jun-2003
RoboCop, 24-Jul-2003
Splinter Cell: Chaos Theory, 08-Apr-2003
Star Wars II: Attack of the Clones, 16-May-2002
Star Wars II: Attack of the Clones, 16-May-2002
The Chronicles of Narnia: The Lion, the Witch and the Wardrobe, 30-Jun-2003
The Chronicles of Narnia: The Lion, the Witch and the Wardrobe, 16-May-2002 |
Clear and Present Danger: Special Collector's Edition, 06-May-2003
Die Another Day: 2-Disc Ultimate Version, 03-Jun-2003
Die Another Day, 03-Jun-2003
Die Another Day, 03-Jun-2003
Golden Eye, 03-Jun-2003
Golden Eye: Special Edition, 03-Jun-2003
Harry Potter and the Chamber of Secrets, 28-May-2002
Harry Potter and the Chamber of Secrets: Two-Disc Special Edition, 28-May-2002
Harry Potter and the Sorcerer's Stone, 28-May-2002
Harry Potter and the Sorcerer's Stone: Two-Disc Special Edition, 28-May-2002
Harry Potter and the Sorcerer's Stone: Full Screen Edition, 28-May-2002
MarioKart: Double Dash, 17-Nov-2003
Pirates of the Caribbean, 30-Jun-2003
RoboCop, 24-Jul-2003
Splinter Cell: Chaos Theory, 08-Apr-2003
Star Wars II: Attack of the Clones, 16-May-2002
Star Wars II: Attack of the Clones, 16-May-2002
The Chronicles of Narnia: The Lion, the Witch and the Wardrobe, 30-Jun-2003
The Chronicles of Narnia: The Lion, the Witch and the Wardrobe, 16-May-2002
As always, I hope this helps somebody who wants to learn how to use Python with the MySQL database.
Installing PostgreSQL 11 on Fedora, Version 30, requires an update to my previous instructions to create a sandboxed user. A sandboxed user can only access a non-data dictionary database with a password. In the real world, rather than a personal test instance you would configure users to include aspects of networking. However, this post is only showing you how to connect from the local server.
This post builds on my PostgreSQL Installation blog post and shows you how to create a tablespace, database, role, and user. It also shows you how to change the default configuration for how users connect to the database.
The following steps create a tablespace, database, role, and user:
- Create tablespace
The directory for the data dictionary changes with PostgreSQL has changed. You can find it with the following command:
postgres=# show data_directory; |
postgres=# show data_directory;
This will return the following:
data_directory
------------------------
/var/lib/pgsql/11/data
(1 row) |
data_directory
------------------------
/var/lib/pgsql/11/data
(1 row)
You need to create a physical videoDB
subdirectory in the /var/lib/pgsql/11
directory. You can use the following syntax from the /var/lib/pgsql/11
directory to create the videoDB
subdirectory:
- Create Tablespace
You can create a video_db
tablespace with the following syntax:
CREATE TABLESPACE video_db
OWNER postgres
LOCATION '/var/lib/pgsql/11/videoDB'; |
CREATE TABLESPACE video_db
OWNER postgres
LOCATION '/var/lib/pgsql/11/videoDB';
This will return the following:
You can query whether you successfully create the video_db
tablespace with the following:
SELECT * FROM pg_tablespace; |
SELECT * FROM pg_tablespace;
It should return the following:
spcname | spcowner | spcacl | spcoptions
------------+----------+--------+------------
pg_default | 10 | |
pg_global | 10 | |
video_db | 10 | |
(3 rows) |
spcname | spcowner | spcacl | spcoptions
------------+----------+--------+------------
pg_default | 10 | |
pg_global | 10 | |
video_db | 10 | |
(3 rows)
- Create a Database
You can create a videodb
database with the following syntax:
CREATE DATABASE videodb
WITH OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = video_db
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
CONNECTION LIMIT = -1; |
CREATE DATABASE videodb
WITH OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = video_db
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
CONNECTION LIMIT = -1;
You can verify the creation of the videodb
with the following command:
It should show you a display like the following:
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
videodb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres+
| | | | | dba=CTc/postgres
(4 rows) |
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
videodb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres+
| | | | | dba=CTc/postgres
(4 rows)
Then, you can assign comment to the database with the following syntax:
COMMENT ON DATABASE videodb IS 'Video Database'; |
COMMENT ON DATABASE videodb IS 'Video Database';
- Create a Role, Grant, and User
In this section you create a dba
role, grant privileges on a videodb
database to a role, and create a user with the role that you created previously with the following three statements. There are three steps in this sections.
- The first step creates a
dba
role:
CREATE ROLE dba WITH SUPERUSER; |
CREATE ROLE dba WITH SUPERUSER;
- The second step grants all privileges on a
videodb
database to a dba
role:
GRANT ALL PRIVILEGES ON DATABASE videodb TO dba; |
GRANT ALL PRIVILEGES ON DATABASE videodb TO dba;
- The third step creates a
student
user with the dba
role:
CREATE USER student
WITH ROLE dba
ENCRYPTED PASSWORD 'student'; |
CREATE USER student
WITH ROLE dba
ENCRYPTED PASSWORD 'student';
- It is possible that you may (and should if this is a new instance you are building) encounter an error when you try to connect as a sandboxed user. The syntax to connect as the student user is:
psql -d videodb -U student -W |
psql -d videodb -U student -W
You may encounter this error:
psql: FATAL: Peer authentication failed for user "student" |
psql: FATAL: Peer authentication failed for user "student"
You can fix this in PostgreSQL 11 by changing the user access parameters in the pg_hba.conf
configuration file. The file is found in the /var/lib/pgsql/11/data
directory and you need to edit it as the root
or postgres
user.
The default entry is:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer |
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
You should replace it with the following:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local postgres all peer
local videodb student md5 |
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local postgres all peer
local videodb student md5
After you save those changes in the pg_hba.conf
file, you need to restart the PostgreSQL (postgresql-11
) service. You can do that with the following command as the root
user:
service postgresql-11 restart |
service postgresql-11 restart
- Connect to the
videodb
as the student
user
Once the postgresql-11
service is restarted, you can connect with the sandboxed student
user with this syntax:
psql -d videodb -U student -W |
psql -d videodb -U student -W
If you did everything correctly, you should see the following after correctly providing the student
password for the student
user:
psql (11.4, server 11.5)
Type "help" for help.
videodb=> |
psql (11.4, server 11.5)
Type "help" for help.
videodb=>
After connecting to the videodb
database, you can query the current database, like
SELECT current_database(); |
SELECT current_database();
It should return the following:
current_database
------------------
videodb
(1 row) |
current_database
------------------
videodb
(1 row)
This has shown you how to create a videodb
database, dba
role, and student
user.
While building my student image on Fedora 30, I installed the MySQL PHP Connector (php-mysqlndrp) but neglected to install the Python Connector. This adds the installation and basic test of the Python Connector to the original blog post.
You use the following command with a wildcard as a privileged user. The wildcard is necessary because you need to load two libraries to support Python 2.7 and 3.7, which are installed on Fedora 30. You also need to be the root user or a user that is found in the sudoer’s list:
yum install -y mysql-connector-python* |
yum install -y mysql-connector-python*
Display detailed console log →
Last metadata expiration check: 0:35:46 ago on Tue 20 Aug 2019 05:36:29 PM MDT.
Dependencies resolved.
=====================================================================================================================================
Package Architecture Version Repository Size
=====================================================================================================================================
Installing:
mysql-connector-python x86_64 8.0.17-1.fc30 mysql-connectors-community 435 k
mysql-connector-python-cext x86_64 8.0.17-1.fc30 mysql-connectors-community 7.7 M
mysql-connector-python3 x86_64 8.0.17-1.fc30 mysql-connectors-community 429 k
mysql-connector-python3-cext x86_64 8.0.17-1.fc30 mysql-connectors-community 7.7 M
Installing dependencies:
python2-protobuf noarch 3.6.1-3.fc30 fedora 563 k
python3-protobuf noarch 3.6.1-3.fc30 fedora 568 k
Transaction Summary
=====================================================================================================================================
Install 6 Packages
Total download size: 17 M
Installed size: 89 M
Downloading Packages:
(1/6): python3-protobuf-3.6.1-3.fc30.noarch.rpm 1.0 MB/s | 568 kB 00:00
(2/6): python2-protobuf-3.6.1-3.fc30.noarch.rpm 994 kB/s | 563 kB 00:00
(3/6): mysql-connector-python-8.0.17-1.fc30.x86_64.rpm 481 kB/s | 435 kB 00:00
(4/6): mysql-connector-python3-8.0.17-1.fc30.x86_64.rpm 612 kB/s | 429 kB 00:00
(5/6): mysql-connector-python-cext-8.0.17-1.fc30.x86_64.rpm 3.8 MB/s | 7.7 MB 00:02
(6/6): mysql-connector-python3-cext-8.0.17-1.fc30.x86_64.rpm 4.2 MB/s | 7.7 MB 00:01
-------------------------------------------------------------------------------------------------------------------------------------
Total 5.4 MB/s | 17 MB 00:03
warning: /var/cache/dnf/mysql-connectors-community-8bcc2bd350b53f70/packages/mysql-connector-python-8.0.17-1.fc30.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
MySQL Connectors Community 7.0 MB/s | 27 kB 00:00
Importing GPG key 0x5072E1F5:
Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python3-protobuf-3.6.1-3.fc30.noarch 1/6
Installing : python2-protobuf-3.6.1-3.fc30.noarch 2/6
Installing : mysql-connector-python-8.0.17-1.fc30.x86_64 3/6
Installing : mysql-connector-python3-8.0.17-1.fc30.x86_64 4/6
Installing : mysql-connector-python3-cext-8.0.17-1.fc30.x86_64 5/6
Installing : mysql-connector-python-cext-8.0.17-1.fc30.x86_64 6/6
Running scriptlet: mysql-connector-python-cext-8.0.17-1.fc30.x86_64 6/6
Verifying : python2-protobuf-3.6.1-3.fc30.noarch 1/6
Verifying : python3-protobuf-3.6.1-3.fc30.noarch 2/6
Verifying : mysql-connector-python-8.0.17-1.fc30.x86_64 3/6
Verifying : mysql-connector-python-cext-8.0.17-1.fc30.x86_64 4/6
Verifying : mysql-connector-python3-8.0.17-1.fc30.x86_64 5/6
Verifying : mysql-connector-python3-cext-8.0.17-1.fc30.x86_64 6/6
Installed:
mysql-connector-python-8.0.17-1.fc30.x86_64 mysql-connector-python-cext-8.0.17-1.fc30.x86_64
mysql-connector-python3-8.0.17-1.fc30.x86_64 mysql-connector-python3-cext-8.0.17-1.fc30.x86_64
python2-protobuf-3.6.1-3.fc30.noarch python3-protobuf-3.6.1-3.fc30.noarch
Complete! |
Last metadata expiration check: 0:35:46 ago on Tue 20 Aug 2019 05:36:29 PM MDT.
Dependencies resolved.
=====================================================================================================================================
Package Architecture Version Repository Size
=====================================================================================================================================
Installing:
mysql-connector-python x86_64 8.0.17-1.fc30 mysql-connectors-community 435 k
mysql-connector-python-cext x86_64 8.0.17-1.fc30 mysql-connectors-community 7.7 M
mysql-connector-python3 x86_64 8.0.17-1.fc30 mysql-connectors-community 429 k
mysql-connector-python3-cext x86_64 8.0.17-1.fc30 mysql-connectors-community 7.7 M
Installing dependencies:
python2-protobuf noarch 3.6.1-3.fc30 fedora 563 k
python3-protobuf noarch 3.6.1-3.fc30 fedora 568 k
Transaction Summary
=====================================================================================================================================
Install 6 Packages
Total download size: 17 M
Installed size: 89 M
Downloading Packages:
(1/6): python3-protobuf-3.6.1-3.fc30.noarch.rpm 1.0 MB/s | 568 kB 00:00
(2/6): python2-protobuf-3.6.1-3.fc30.noarch.rpm 994 kB/s | 563 kB 00:00
(3/6): mysql-connector-python-8.0.17-1.fc30.x86_64.rpm 481 kB/s | 435 kB 00:00
(4/6): mysql-connector-python3-8.0.17-1.fc30.x86_64.rpm 612 kB/s | 429 kB 00:00
(5/6): mysql-connector-python-cext-8.0.17-1.fc30.x86_64.rpm 3.8 MB/s | 7.7 MB 00:02
(6/6): mysql-connector-python3-cext-8.0.17-1.fc30.x86_64.rpm 4.2 MB/s | 7.7 MB 00:01
-------------------------------------------------------------------------------------------------------------------------------------
Total 5.4 MB/s | 17 MB 00:03
warning: /var/cache/dnf/mysql-connectors-community-8bcc2bd350b53f70/packages/mysql-connector-python-8.0.17-1.fc30.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
MySQL Connectors Community 7.0 MB/s | 27 kB 00:00
Importing GPG key 0x5072E1F5:
Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python3-protobuf-3.6.1-3.fc30.noarch 1/6
Installing : python2-protobuf-3.6.1-3.fc30.noarch 2/6
Installing : mysql-connector-python-8.0.17-1.fc30.x86_64 3/6
Installing : mysql-connector-python3-8.0.17-1.fc30.x86_64 4/6
Installing : mysql-connector-python3-cext-8.0.17-1.fc30.x86_64 5/6
Installing : mysql-connector-python-cext-8.0.17-1.fc30.x86_64 6/6
Running scriptlet: mysql-connector-python-cext-8.0.17-1.fc30.x86_64 6/6
Verifying : python2-protobuf-3.6.1-3.fc30.noarch 1/6
Verifying : python3-protobuf-3.6.1-3.fc30.noarch 2/6
Verifying : mysql-connector-python-8.0.17-1.fc30.x86_64 3/6
Verifying : mysql-connector-python-cext-8.0.17-1.fc30.x86_64 4/6
Verifying : mysql-connector-python3-8.0.17-1.fc30.x86_64 5/6
Verifying : mysql-connector-python3-cext-8.0.17-1.fc30.x86_64 6/6
Installed:
mysql-connector-python-8.0.17-1.fc30.x86_64 mysql-connector-python-cext-8.0.17-1.fc30.x86_64
mysql-connector-python3-8.0.17-1.fc30.x86_64 mysql-connector-python3-cext-8.0.17-1.fc30.x86_64
python2-protobuf-3.6.1-3.fc30.noarch python3-protobuf-3.6.1-3.fc30.noarch
Complete!
Leveraging the MySQL Connector/Python Coding Examples documentation, Section 5.1 Connecting to MySQL Using Connector/Python here’s a test of the connection to MySQL 8.
# Import the library.
import mysql.connector
from mysql.connector import errorcode
try:
# Open connection.
cnx = mysql.connector.connect(user='student', password='student',
host='127.0.0.1',
database='studentdb')
# Print the value.
print("Database connection resolved.")
# Handle exception and close connection.
except mysql.connector.Error as e:
if e.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif e.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(e)
# Close the connection when the try block completes.
else:
cnx.close() |
# Import the library.
import mysql.connector
from mysql.connector import errorcode
try:
# Open connection.
cnx = mysql.connector.connect(user='student', password='student',
host='127.0.0.1',
database='studentdb')
# Print the value.
print("Database connection resolved.")
# Handle exception and close connection.
except mysql.connector.Error as e:
if e.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif e.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(e)
# Close the connection when the try block completes.
else:
cnx.close()
Leveraging the MySQL Connector/Python Coding Examples documentation, Section 5.4 Querying Data Using Connector/Python here’s a test of the connection to MySQL 8.
# Import the library.
import datetime
import mysql.connector
from mysql.connector import errorcode
try:
# Open connection.
cnx = mysql.connector.connect(user='student', password='student',
host='127.0.0.1',
database='studentdb')
# Create cursor.
cursor = cnx.cursor()
# Set the query statement.
query = ("SELECT "
"CASE "
" WHEN item_subtitle IS NULL THEN item_title "
" ELSE CONCAT(item_title,': ',item_subtitle) "
"END AS title, "
"release_date "
"FROM item "
"WHERE release_date BETWEEN %s AND %s "
"ORDER BY item_title")
# Set the start and end date.
start_date = datetime.date(1991, 1, 1)
end_date = datetime.date(2004, 12, 31)
# Execute cursor.
cursor.execute(query, (start_date, end_date))
# Display the rows returned by the query.
for (item_name, release_date) in cursor:
print("{}, {:%d %b %Y}".format(item_name, release_date))
# Close cursor.
cursor.close()
# ------------------------------------------------------------
# Handle exception and close connection.
except mysql.connector.Error as e:
if e.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif e.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print "Error code:", e.errno # error number
print "SQLSTATE value:", e.sqlstate # SQLSTATE value
print "Error message:", e.msg # error message
# Close the connection when the try block completes.
else:
cnx.close() |
# Import the library.
import datetime
import mysql.connector
from mysql.connector import errorcode
try:
# Open connection.
cnx = mysql.connector.connect(user='student', password='student',
host='127.0.0.1',
database='studentdb')
# Create cursor.
cursor = cnx.cursor()
# Set the query statement.
query = ("SELECT "
"CASE "
" WHEN item_subtitle IS NULL THEN item_title "
" ELSE CONCAT(item_title,': ',item_subtitle) "
"END AS title, "
"release_date "
"FROM item "
"WHERE release_date BETWEEN %s AND %s "
"ORDER BY item_title")
# Set the start and end date.
start_date = datetime.date(1991, 1, 1)
end_date = datetime.date(2004, 12, 31)
# Execute cursor.
cursor.execute(query, (start_date, end_date))
# Display the rows returned by the query.
for (item_name, release_date) in cursor:
print("{}, {:%d %b %Y}".format(item_name, release_date))
# Close cursor.
cursor.close()
# ------------------------------------------------------------
# Handle exception and close connection.
except mysql.connector.Error as e:
if e.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif e.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print "Error code:", e.errno # error number
print "SQLSTATE value:", e.sqlstate # SQLSTATE value
print "Error message:", e.msg # error message
# Close the connection when the try block completes.
else:
cnx.close()
If you run the above in Python 2.7 it works fine. It fails to parse successfully in Python 3.x because the print()
function requires the parentheses all the time. You would need to re-write the except
block, like this with the parentheses:
# Handle exception and close connection.
except mysql.connector.Error as e:
if e.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif e.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print("Error code:", e.errno) # error number
print("SQLSTATE value:", e.sqlstate) # SQLSTATE value
print("Error message:", e.msg) # error message |
# Handle exception and close connection.
except mysql.connector.Error as e:
if e.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif e.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print("Error code:", e.errno) # error number
print("SQLSTATE value:", e.sqlstate) # SQLSTATE value
print("Error message:", e.msg) # error message
While it works without the parentheses in Python 2.7, it also works with the parentheses. That means the best practice is to write cross compatible code by always using the parentheses with the print()
function.
As always, I hope this helps somebody.j
Installing PostreSQL 11 on Fedora 30 wasn’t straight forward but there were some instructions that helped. The first step requires you to update the yum
repository, like this as the root
user:
rpm -Uvh https://yum.postgresql.org/11/fedora/fedora-30-x86_64/pgdg-fedora-repo-latest.noarch.rpm |
rpm -Uvh https://yum.postgresql.org/11/fedora/fedora-30-x86_64/pgdg-fedora-repo-latest.noarch.rpm
Then, you install the PostgreSQL with this command as the root
user:
dnf install postgresql11-server |
dnf install postgresql11-server
After installing the PostreSQL Server I got a few errors with the symbolic links failing to resolve in the log files. Then, I realized they only failed to create symbolic links because the fresh installation deploys executables directly to the /usr/bin
directory.
Display detailed console log →
Retrieving https://yum.postgresql.org/11/fedora/fedora-30-x86_64/pgdg-fedora-repo-latest.noarch.rpm
warning: /var/tmp/rpm-tmp.MD4lRU: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:pgdg-fedora-repo-42.0-4 ################################# [100%]
[root@localhost ~]# dnf install postgresql11-server
PostgreSQL 11 30 - x86_64 215 kB/s | 585 kB 00:02
PostgreSQL 10 30 - x86_64 199 kB/s | 541 kB 00:02
PostgreSQL 9.6 30 - x86_64 295 kB/s | 515 kB 00:01
PostgreSQL 9.5 30 - x86_64 179 kB/s | 495 kB 00:02
PostgreSQL 9.4 30 - x86_64 269 kB/s | 469 kB 00:01
Last metadata expiration check: 0:00:01 ago on Mon 19 Aug 2019 02:25:56 AM MDT.
Dependencies resolved.
==================================================================================================================
Package Architecture Version Repository Size
==================================================================================================================
Installing:
postgresql11-server x86_64 11.5-1PGDG.f30 pgdg11 4.8 M
Installing dependencies:
postgresql11 x86_64 11.5-1PGDG.f30 pgdg11 1.7 M
postgresql11-libs x86_64 11.5-1PGDG.f30 pgdg11 374 k
Transaction Summary
==================================================================================================================
Install 3 Packages
Total download size: 6.9 M
Installed size: 32 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): postgresql11-libs-11.5-1PGDG.f30.x86_64.rpm 213 kB/s | 374 kB 00:01
(2/3): postgresql11-11.5-1PGDG.f30.x86_64.rpm 698 kB/s | 1.7 MB 00:02
(3/3): postgresql11-server-11.5-1PGDG.f30.x86_64.rpm 1.5 MB/s | 4.8 MB 00:03
------------------------------------------------------------------------------------------------------------------
Total 2.2 MB/s | 6.9 MB 00:03
warning: /var/cache/dnf/pgdg11-cde8ad453ae6cd5b/packages/postgresql11-11.5-1PGDG.f30.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
PostgreSQL 11 30 - x86_64 1.6 MB/s | 1.7 kB 00:00
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsqlrpms-hackers@pgfoundry.org>"
Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : postgresql11-libs-11.5-1PGDG.f30.x86_64 1/3
Running scriptlet: postgresql11-libs-11.5-1PGDG.f30.x86_64 1/3
Installing : postgresql11-11.5-1PGDG.f30.x86_64 2/3
Running scriptlet: postgresql11-11.5-1PGDG.f30.x86_64 2/3
failed to link /usr/bin/psql -> /etc/alternatives/pgsql-psql: /usr/bin/psql exists and it is not a symlink
failed to link /usr/bin/clusterdb -> /etc/alternatives/pgsql-clusterdb: /usr/bin/clusterdb exists and it is not a symlink
failed to link /usr/bin/createdb -> /etc/alternatives/pgsql-createdb: /usr/bin/createdb exists and it is not a symlink
failed to link /usr/bin/createuser -> /etc/alternatives/pgsql-createuser: /usr/bin/createuser exists and it is not a symlink
failed to link /usr/bin/dropdb -> /etc/alternatives/pgsql-dropdb: /usr/bin/dropdb exists and it is not a symlink
failed to link /usr/bin/dropuser -> /etc/alternatives/pgsql-dropuser: /usr/bin/dropuser exists and it is not a symlink
failed to link /usr/bin/pg_dump -> /etc/alternatives/pgsql-pg_dump: /usr/bin/pg_dump exists and it is not a symlink
failed to link /usr/bin/pg_dumpall -> /etc/alternatives/pgsql-pg_dumpall: /usr/bin/pg_dumpall exists and it is not a symlink
failed to link /usr/bin/pg_restore -> /etc/alternatives/pgsql-pg_restore: /usr/bin/pg_restore exists and it is not a symlink
failed to link /usr/bin/reindexdb -> /etc/alternatives/pgsql-reindexdb: /usr/bin/reindexdb exists and it is not a symlink
failed to link /usr/bin/vacuumdb -> /etc/alternatives/pgsql-vacuumdb: /usr/bin/vacuumdb exists and it is not a symlink
Running scriptlet: postgresql11-server-11.5-1PGDG.f30.x86_64 3/3
Installing : postgresql11-server-11.5-1PGDG.f30.x86_64 3/3
Running scriptlet: postgresql11-server-11.5-1PGDG.f30.x86_64 3/3
Verifying : postgresql11-11.5-1PGDG.f30.x86_64 1/3
Verifying : postgresql11-libs-11.5-1PGDG.f30.x86_64 2/3
Verifying : postgresql11-server-11.5-1PGDG.f30.x86_64 3/3
Installed:
postgresql11-server-11.5-1PGDG.f30.x86_64 postgresql11-11.5-1PGDG.f30.x86_64
postgresql11-libs-11.5-1PGDG.f30.x86_64
Complete! |
Retrieving https://yum.postgresql.org/11/fedora/fedora-30-x86_64/pgdg-fedora-repo-latest.noarch.rpm
warning: /var/tmp/rpm-tmp.MD4lRU: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:pgdg-fedora-repo-42.0-4 ################################# [100%]
[root@localhost ~]# dnf install postgresql11-server
PostgreSQL 11 30 - x86_64 215 kB/s | 585 kB 00:02
PostgreSQL 10 30 - x86_64 199 kB/s | 541 kB 00:02
PostgreSQL 9.6 30 - x86_64 295 kB/s | 515 kB 00:01
PostgreSQL 9.5 30 - x86_64 179 kB/s | 495 kB 00:02
PostgreSQL 9.4 30 - x86_64 269 kB/s | 469 kB 00:01
Last metadata expiration check: 0:00:01 ago on Mon 19 Aug 2019 02:25:56 AM MDT.
Dependencies resolved.
==================================================================================================================
Package Architecture Version Repository Size
==================================================================================================================
Installing:
postgresql11-server x86_64 11.5-1PGDG.f30 pgdg11 4.8 M
Installing dependencies:
postgresql11 x86_64 11.5-1PGDG.f30 pgdg11 1.7 M
postgresql11-libs x86_64 11.5-1PGDG.f30 pgdg11 374 k
Transaction Summary
==================================================================================================================
Install 3 Packages
Total download size: 6.9 M
Installed size: 32 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): postgresql11-libs-11.5-1PGDG.f30.x86_64.rpm 213 kB/s | 374 kB 00:01
(2/3): postgresql11-11.5-1PGDG.f30.x86_64.rpm 698 kB/s | 1.7 MB 00:02
(3/3): postgresql11-server-11.5-1PGDG.f30.x86_64.rpm 1.5 MB/s | 4.8 MB 00:03
------------------------------------------------------------------------------------------------------------------
Total 2.2 MB/s | 6.9 MB 00:03
warning: /var/cache/dnf/pgdg11-cde8ad453ae6cd5b/packages/postgresql11-11.5-1PGDG.f30.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
PostgreSQL 11 30 - x86_64 1.6 MB/s | 1.7 kB 00:00
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsqlrpms-hackers@pgfoundry.org>"
Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : postgresql11-libs-11.5-1PGDG.f30.x86_64 1/3
Running scriptlet: postgresql11-libs-11.5-1PGDG.f30.x86_64 1/3
Installing : postgresql11-11.5-1PGDG.f30.x86_64 2/3
Running scriptlet: postgresql11-11.5-1PGDG.f30.x86_64 2/3
failed to link /usr/bin/psql -> /etc/alternatives/pgsql-psql: /usr/bin/psql exists and it is not a symlink
failed to link /usr/bin/clusterdb -> /etc/alternatives/pgsql-clusterdb: /usr/bin/clusterdb exists and it is not a symlink
failed to link /usr/bin/createdb -> /etc/alternatives/pgsql-createdb: /usr/bin/createdb exists and it is not a symlink
failed to link /usr/bin/createuser -> /etc/alternatives/pgsql-createuser: /usr/bin/createuser exists and it is not a symlink
failed to link /usr/bin/dropdb -> /etc/alternatives/pgsql-dropdb: /usr/bin/dropdb exists and it is not a symlink
failed to link /usr/bin/dropuser -> /etc/alternatives/pgsql-dropuser: /usr/bin/dropuser exists and it is not a symlink
failed to link /usr/bin/pg_dump -> /etc/alternatives/pgsql-pg_dump: /usr/bin/pg_dump exists and it is not a symlink
failed to link /usr/bin/pg_dumpall -> /etc/alternatives/pgsql-pg_dumpall: /usr/bin/pg_dumpall exists and it is not a symlink
failed to link /usr/bin/pg_restore -> /etc/alternatives/pgsql-pg_restore: /usr/bin/pg_restore exists and it is not a symlink
failed to link /usr/bin/reindexdb -> /etc/alternatives/pgsql-reindexdb: /usr/bin/reindexdb exists and it is not a symlink
failed to link /usr/bin/vacuumdb -> /etc/alternatives/pgsql-vacuumdb: /usr/bin/vacuumdb exists and it is not a symlink
Running scriptlet: postgresql11-server-11.5-1PGDG.f30.x86_64 3/3
Installing : postgresql11-server-11.5-1PGDG.f30.x86_64 3/3
Running scriptlet: postgresql11-server-11.5-1PGDG.f30.x86_64 3/3
Verifying : postgresql11-11.5-1PGDG.f30.x86_64 1/3
Verifying : postgresql11-libs-11.5-1PGDG.f30.x86_64 2/3
Verifying : postgresql11-server-11.5-1PGDG.f30.x86_64 3/3
Installed:
postgresql11-server-11.5-1PGDG.f30.x86_64 postgresql11-11.5-1PGDG.f30.x86_64
postgresql11-libs-11.5-1PGDG.f30.x86_64
Complete!
After installing the PostgreSQL Server 11, you need to initialize the database. You use the following command to initialize the database as the root user:
/usr/pgsql-11/bin/postgresql-11-setup initdb |
/usr/pgsql-11/bin/postgresql-11-setup initdb
It should return the following:
Initializing database ... OK |
Initializing database ... OK
The PostgreSQL Server 11 database installs in the /var/lib/pgsql/11/data
directory. You can list the contents, which should mirror these:
drwx------. 5 postgres postgres 4096 Aug 19 02:45 base
drwx------. 2 postgres postgres 4096 Aug 19 02:45 global
drwx------. 2 postgres postgres 4096 Aug 19 02:45 log
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_commit_ts
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_dynshmem
-rw-------. 1 postgres postgres 4269 Aug 19 02:45 pg_hba.conf
-rw-------. 1 postgres postgres 1636 Aug 19 02:45 pg_ident.conf
drwx------. 4 postgres postgres 4096 Aug 19 02:45 pg_logical
drwx------. 4 postgres postgres 4096 Aug 19 02:45 pg_multixact
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_notify
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_replslot
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_serial
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_snapshots
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_stat
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_stat_tmp
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_subtrans
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_tblspc
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_twophase
-rw-------. 1 postgres postgres 3 Aug 19 02:45 PG_VERSION
drwx------. 3 postgres postgres 4096 Aug 19 02:45 pg_wal
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_xact
-rw-------. 1 postgres postgres 88 Aug 19 02:45 postgresql.auto.conf
-rw-------. 1 postgres postgres 23895 Aug 19 02:45 postgresql.conf |
drwx------. 5 postgres postgres 4096 Aug 19 02:45 base
drwx------. 2 postgres postgres 4096 Aug 19 02:45 global
drwx------. 2 postgres postgres 4096 Aug 19 02:45 log
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_commit_ts
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_dynshmem
-rw-------. 1 postgres postgres 4269 Aug 19 02:45 pg_hba.conf
-rw-------. 1 postgres postgres 1636 Aug 19 02:45 pg_ident.conf
drwx------. 4 postgres postgres 4096 Aug 19 02:45 pg_logical
drwx------. 4 postgres postgres 4096 Aug 19 02:45 pg_multixact
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_notify
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_replslot
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_serial
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_snapshots
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_stat
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_stat_tmp
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_subtrans
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_tblspc
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_twophase
-rw-------. 1 postgres postgres 3 Aug 19 02:45 PG_VERSION
drwx------. 3 postgres postgres 4096 Aug 19 02:45 pg_wal
drwx------. 2 postgres postgres 4096 Aug 19 02:45 pg_xact
-rw-------. 1 postgres postgres 88 Aug 19 02:45 postgresql.auto.conf
-rw-------. 1 postgres postgres 23895 Aug 19 02:45 postgresql.conf
You need to enable and start the postgresql-11.service
with the following commands as the root
user:
systemctl enable postgresql-11.service
systemctl start postgresql-11.service |
systemctl enable postgresql-11.service
systemctl start postgresql-11.service
You can login to test the configuration as the root
user, like this:
You will see something like this:
psql: /usr/pgsql-11/lib/libpq.so.5: no version information available (required by psql)
psql: /usr/pgsql-11/lib/libpq.so.5: no version information available (required by psql)
psql (11.4, server 11.5)
Type "help" for help.
postgres=# |
psql: /usr/pgsql-11/lib/libpq.so.5: no version information available (required by psql)
psql: /usr/pgsql-11/lib/libpq.so.5: no version information available (required by psql)
psql (11.4, server 11.5)
Type "help" for help.
postgres=#
The error message appear to indicate there’s a bug (at least Bug #15798 is similar). Specifically, a missing function in the libya.so.5 library. Determining that impact took some time because of what else I had in the queue.
The Bug (at least Bug #15798 gave part of the fix. The problem was figuring out where the LD_LIBRARY_PATH should really be set, and I sorted that out.
If you inspect the postgres
home directory (/var/lib/pgsql
), you’ll find the following .bash_profile
file:
[ -f /etc/profile ] && source /etc/profile
PGDATA=/var/lib/pgsql/11/data
export PGDATA
# If you want to customize your settings,
# Use the file below. This is not overridden
# by the RPMS.
[ -f /var/lib/pgsql/.pgsql_profile ] && source /var/lib/pgsql/.pgsql_profile |
[ -f /etc/profile ] && source /etc/profile
PGDATA=/var/lib/pgsql/11/data
export PGDATA
# If you want to customize your settings,
# Use the file below. This is not overridden
# by the RPMS.
[ -f /var/lib/pgsql/.pgsql_profile ] && source /var/lib/pgsql/.pgsql_profile
Then, you create the .pgsql_profile
file in that directory. You should put the following command in the file:
export set LD_LIBRARY_PATH=/usr/lib64 needle < /dev/null |
export set LD_LIBRARY_PATH=/usr/lib64 needle < /dev/null
Then, when you login as the postgres
user:
You will see:
psql (11.4, server 11.5)
Type "help" for help.
postgres=# |
psql (11.4, server 11.5)
Type "help" for help.
postgres=#
or, you can login to test the configuration as the root
user with the syntax used earlier:
You need to put the LD_LIBRARY_PATH
environment variable in the .bashrc
of users who will access the PostgreSQL 11 database.
As always, I hope this helps those working it from the ground up.
Oracle error messages are more or less the best in the industry but time-to-time they saddle you with a bad or misleading message. For example, I was running one of the code modules from my Oracle Database 12c PL/SQL Programming book for a class exercise and got this error message:
BEGIN
*
ERROR AT line 1:
ORA-22288: FILE OR LOB operation failed
ORA-06512: AT "STUDENT.LOAD_CLOB_FROM_FILE", line 71
ORA-06512: AT line 11 |
BEGIN
*
ERROR at line 1:
ORA-22288: file or LOB operation failed
ORA-06512: at "STUDENT.LOAD_CLOB_FROM_FILE", line 71
ORA-06512: at line 11
Oddly enough, it was simple to identify generally. It failed on a call to the DBMS_LOB.LOADCLOBFROMFILE
procedure. However, the better question is why did it fail because the virtual directory resolved and the permissions worked.
The first test was to try another file, which worked perfectly with the same code. That meant it had to be something with the physical file. I took a look and sure enough I found a character set problem, like the following:
… he reveals that the Nazgûl, or Ringwraiths, have left Mordor to capture the Ring and kill whoever carries it.
and,
The group flees to the elvish realm of Lothlórien …
The “û” and “ó” characters were incompatible with the default NLS_LANG
setting of the database and a CLOB
limits the use of non-standard character sets. It’s ashamed that Oracle didn’t through a character set error, which would have expedited resolution of the problem.
As always, I hope this helps those looking for solutions.
I found that MongoDB instructions changed significantly from a year ago. More or less, there was no pre-configured yum
repository. Fortunately, the following web page was very helpful though not specific about Fedora.
Installing MongoDB 4.0 on Fedora 30 requires updating the yum
repository. You need to create the mongodb.repo
file as the root
user in the /etc/yum.repos.d
directory. The mongodb.repo
file should contain the following:
[Mongodb]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc |
[Mongodb]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
After you create the appropriate mongodb.repo
file, you can run the following command to install the MongoDB database.
It will produce the following log:
MongoDB Repository 31 kB/s | 21 kB 00:00
Dependencies resolved.
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mongodb-org x86_64 4.0.12-1.amzn1 Mongodb 5.8 k
Installing dependencies:
mongodb-org-mongos x86_64 4.0.12-1.amzn1 Mongodb 11 M
mongodb-org-server x86_64 4.0.12-1.amzn1 Mongodb 20 M
mongodb-org-shell x86_64 4.0.12-1.amzn1 Mongodb 13 M
mongodb-org-tools x86_64 4.0.12-1.amzn1 Mongodb 29 M
Transaction Summary
=============================================================================
Install 5 Packages
Total download size: 73 M
Installed size: 213 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): mongodb-org-4.0.12-1.amzn1.x86_64.rpm 18 kB/s | 5.8 kB 00:00
(2/5): mongodb-org-shell-4.0.12-1.amzn1.x86_ 4.6 MB/s | 13 MB 00:02
(3/5): mongodb-org-mongos-4.0.12-1.amzn1.x86 1.8 MB/s | 11 MB 00:06
(4/5): mongodb-org-tools-4.0.12-1.amzn1.x86_ 6.6 MB/s | 29 MB 00:04
(5/5): mongodb-org-server-4.0.12-1.amzn1.x86 2.5 MB/s | 20 MB 00:08
-----------------------------------------------------------------------------
Total 9.0 MB/s | 73 MB 00:08
warning: /var/cache/dnf/Mongodb-f722cd88d61a4e38/packages/mongodb-org-4.0.12-1.amzn1.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID e52529d4: NOKEY
MongoDB Repository 3.0 kB/s | 1.7 kB 00:00
Importing GPG key 0xE52529D4:
Userid : "MongoDB 4.0 Release Signing Key <packaging@mongodb.com>"
Fingerprint: 9DA3 1620 334B D75D 9DCB 49F3 6881 8C72 E525 29D4
From : https://www.mongodb.org/static/pgp/server-4.0.asc
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mongodb-org-tools-4.0.12-1.amzn1.x86_64 1/5
Installing : mongodb-org-shell-4.0.12-1.amzn1.x86_64 2/5
Running scriptlet: mongodb-org-server-4.0.12-1.amzn1.x86_64 3/5
Installing : mongodb-org-server-4.0.12-1.amzn1.x86_64 3/5
Running scriptlet: mongodb-org-server-4.0.12-1.amzn1.x86_64 3/5
Installing : mongodb-org-mongos-4.0.12-1.amzn1.x86_64 4/5
Installing : mongodb-org-4.0.12-1.amzn1.x86_64 5/5
Running scriptlet: mongodb-org-4.0.12-1.amzn1.x86_64 5/5
Verifying : mongodb-org-4.0.12-1.amzn1.x86_64 1/5
Verifying : mongodb-org-mongos-4.0.12-1.amzn1.x86_64 2/5
Verifying : mongodb-org-server-4.0.12-1.amzn1.x86_64 3/5
Verifying : mongodb-org-shell-4.0.12-1.amzn1.x86_64 4/5
Verifying : mongodb-org-tools-4.0.12-1.amzn1.x86_64 5/5
Installed:
mongodb-org-4.0.12-1.amzn1.x86_64
mongodb-org-mongos-4.0.12-1.amzn1.x86_64
mongodb-org-server-4.0.12-1.amzn1.x86_64
mongodb-org-shell-4.0.12-1.amzn1.x86_64
mongodb-org-tools-4.0.12-1.amzn1.x86_64
Complete! |
MongoDB Repository 31 kB/s | 21 kB 00:00
Dependencies resolved.
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mongodb-org x86_64 4.0.12-1.amzn1 Mongodb 5.8 k
Installing dependencies:
mongodb-org-mongos x86_64 4.0.12-1.amzn1 Mongodb 11 M
mongodb-org-server x86_64 4.0.12-1.amzn1 Mongodb 20 M
mongodb-org-shell x86_64 4.0.12-1.amzn1 Mongodb 13 M
mongodb-org-tools x86_64 4.0.12-1.amzn1 Mongodb 29 M
Transaction Summary
=============================================================================
Install 5 Packages
Total download size: 73 M
Installed size: 213 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): mongodb-org-4.0.12-1.amzn1.x86_64.rpm 18 kB/s | 5.8 kB 00:00
(2/5): mongodb-org-shell-4.0.12-1.amzn1.x86_ 4.6 MB/s | 13 MB 00:02
(3/5): mongodb-org-mongos-4.0.12-1.amzn1.x86 1.8 MB/s | 11 MB 00:06
(4/5): mongodb-org-tools-4.0.12-1.amzn1.x86_ 6.6 MB/s | 29 MB 00:04
(5/5): mongodb-org-server-4.0.12-1.amzn1.x86 2.5 MB/s | 20 MB 00:08
-----------------------------------------------------------------------------
Total 9.0 MB/s | 73 MB 00:08
warning: /var/cache/dnf/Mongodb-f722cd88d61a4e38/packages/mongodb-org-4.0.12-1.amzn1.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID e52529d4: NOKEY
MongoDB Repository 3.0 kB/s | 1.7 kB 00:00
Importing GPG key 0xE52529D4:
Userid : "MongoDB 4.0 Release Signing Key <packaging@mongodb.com>"
Fingerprint: 9DA3 1620 334B D75D 9DCB 49F3 6881 8C72 E525 29D4
From : https://www.mongodb.org/static/pgp/server-4.0.asc
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mongodb-org-tools-4.0.12-1.amzn1.x86_64 1/5
Installing : mongodb-org-shell-4.0.12-1.amzn1.x86_64 2/5
Running scriptlet: mongodb-org-server-4.0.12-1.amzn1.x86_64 3/5
Installing : mongodb-org-server-4.0.12-1.amzn1.x86_64 3/5
Running scriptlet: mongodb-org-server-4.0.12-1.amzn1.x86_64 3/5
Installing : mongodb-org-mongos-4.0.12-1.amzn1.x86_64 4/5
Installing : mongodb-org-4.0.12-1.amzn1.x86_64 5/5
Running scriptlet: mongodb-org-4.0.12-1.amzn1.x86_64 5/5
Verifying : mongodb-org-4.0.12-1.amzn1.x86_64 1/5
Verifying : mongodb-org-mongos-4.0.12-1.amzn1.x86_64 2/5
Verifying : mongodb-org-server-4.0.12-1.amzn1.x86_64 3/5
Verifying : mongodb-org-shell-4.0.12-1.amzn1.x86_64 4/5
Verifying : mongodb-org-tools-4.0.12-1.amzn1.x86_64 5/5
Installed:
mongodb-org-4.0.12-1.amzn1.x86_64
mongodb-org-mongos-4.0.12-1.amzn1.x86_64
mongodb-org-server-4.0.12-1.amzn1.x86_64
mongodb-org-shell-4.0.12-1.amzn1.x86_64
mongodb-org-tools-4.0.12-1.amzn1.x86_64
Complete!
You create a MongoDB service with the following syntax as a privileged user in the sudoer
list:
sudo systemctl enable mongodb.service |
sudo systemctl enable mongodb.service
You can then start the mongod
service with the following command as a privileged user in the sudoer
list:
sudo systemctl start mongod.service |
sudo systemctl start mongod.service
You confirm that it started with the following command as the same privileged user:
sudo service mongod status |
sudo service mongod status
It should produce a log file like this:
● mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod; generated)
Active: active (running) since Fri 2019-08-16 14:57:22 MDT; 2min 57s ago
Docs: man:systemd-sysv-generator(8)
Process: 128115 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, stat>
Tasks: 27 (limit: 4661)
Memory: 47.0M
CGroup: /system.slice/mongod.service
└─128131 /usr/bin/mongod -f /etc/mongod.conf
Aug 16 14:57:21 localhost.localdomain systemd[1]: Starting SYSV: Mongo is a >
Aug 16 14:57:21 localhost.localdomain runuser[128127]: pam_unix(runuser:sess>
Aug 16 14:57:22 localhost.localdomain runuser[128127]: pam_unix(runuser:sess>
Aug 16 14:57:22 localhost.localdomain mongod[128115]: [30B blob data]
Aug 16 14:57:22 localhost.localdomain systemd[1]: Started SYSV: Mongo is a s>
lines 1-15/15 (END) |
● mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod; generated)
Active: active (running) since Fri 2019-08-16 14:57:22 MDT; 2min 57s ago
Docs: man:systemd-sysv-generator(8)
Process: 128115 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, stat>
Tasks: 27 (limit: 4661)
Memory: 47.0M
CGroup: /system.slice/mongod.service
└─128131 /usr/bin/mongod -f /etc/mongod.conf
Aug 16 14:57:21 localhost.localdomain systemd[1]: Starting SYSV: Mongo is a >
Aug 16 14:57:21 localhost.localdomain runuser[128127]: pam_unix(runuser:sess>
Aug 16 14:57:22 localhost.localdomain runuser[128127]: pam_unix(runuser:sess>
Aug 16 14:57:22 localhost.localdomain mongod[128115]: [30B blob data]
Aug 16 14:57:22 localhost.localdomain systemd[1]: Started SYSV: Mongo is a s>
lines 1-15/15 (END)
You close the service log with a “q
“. You can determine your version with the following command:
It should show you something like this:
db version v4.0.12
git version: 5776e3cbf9e7afe86e6b29e22520ffb6766e95d4
OpenSSL version: OpenSSL 1.0.0-fips 29 Mar 2010
allocator: tcmalloc
modules: none
build environment:
distmod: amazon
distarch: x86_64
target_arch: x86_64 |
db version v4.0.12
git version: 5776e3cbf9e7afe86e6b29e22520ffb6766e95d4
OpenSSL version: OpenSSL 1.0.0-fips 29 Mar 2010
allocator: tcmalloc
modules: none
build environment:
distmod: amazon
distarch: x86_64
target_arch: x86_64
You can connect to the MongoDB shell with the following command:
Inside the MongoDB shell, you can run standard MongoDB commands, like:
> use mydb;
switched to db mydb
> db.version()
4.0.12
> db.stats()
{
"db" : "mydb",
"collections" : 0,
"views" : 0,
"objects" : 0,
"avgObjSize" : 0,
"dataSize" : 0,
"storageSize" : 0,
"numExtents" : 0,
"indexes" : 0,
"indexSize" : 0,
"fileSize" : 0,
"fsUsedSize" : 0,
"fsTotalSize" : 0,
"ok" : 1
}
> quit() |
> use mydb;
switched to db mydb
> db.version()
4.0.12
> db.stats()
{
"db" : "mydb",
"collections" : 0,
"views" : 0,
"objects" : 0,
"avgObjSize" : 0,
"dataSize" : 0,
"storageSize" : 0,
"numExtents" : 0,
"indexes" : 0,
"indexSize" : 0,
"fileSize" : 0,
"fsUsedSize" : 0,
"fsTotalSize" : 0,
"ok" : 1
}
> quit()
As always, I hope this helps those looking for the missing steps.
There was an option during the Fedora 30 Workstation installation to add the Apache Web Server, but you need to set it to start automatically. Unfortunately, there was no option to install PHP, which I thought odd because of how many web developers learn the trade first on PHP with a LAMP (Linux, Apache, MySQL, Perl/PHP/Python) stack. You see how to fix that shortcoming in this post and how to install and test PHP, mysqli
, and pdo
to support MySQL 8.
Before you do that make sure you install MySQL 8. You can find my prior blog post on that here.
You set Apache to start automatically, on the next boot of the operating system, with the following command:
It creates a symbolic link:
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service. |
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
However, that command only starts the Apache server the next time you boot the server. You use the following command as the root
user to start the Apache server:
You can verify the installation with the following command as the root
user:
ps -ef | grep httpd | grep -v grep |
ps -ef | grep httpd | grep -v grep
It should return:
root 5433 1 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5434 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5435 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5436 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5437 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5438 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5442 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND |
root 5433 1 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5434 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5435 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5436 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5437 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5438 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 5442 5433 0 17:03 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
and, then verify the listening port with the following command as the root
user:
netstat -tulpn | grep :80 |
netstat -tulpn | grep :80
It should return the following when both the Apache server is listening on port 80 and the Oracle multi-protocol server is listening on port 8080:
tcp6 0 0 :::80 :::* LISTEN 119810/httpd
tcp6 0 0 :::8080 :::* LISTEN 1403/tnslsnr |
tcp6 0 0 :::80 :::* LISTEN 119810/httpd
tcp6 0 0 :::8080 :::* LISTEN 1403/tnslsnr
You can also enter the following URL in the browser to see the Apache Test Page:
It should display the test page, like this:

You can also create a hello.htm
file in the /var/www/html
directory to test the ability to read an HTML file. I would suggest the traditional hello.htm
file:
<html>
<body>
Hello World!
</body>
</html> |
<html>
<body>
Hello World!
</body>
</html>
You can call it by using this URL in the browser:
http://localhost/hello.htm |
http://localhost/hello.htm
It should display the test page, like this:
Now, let’s install PHP. You use the following command as a privileged user, which is one found in the sudoer’s list:
Display detailed console log →
Last metadata expiration check: 0:37:02 ago on Fri 16 Aug 2019 11:03:54 AM MDT.
Dependencies resolved.
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
php x86_64 7.3.8-1.fc30 updates 2.8 M
Installing dependencies:
nginx-filesystem noarch 1:1.16.0-3.fc30 updates 11 k
php-cli x86_64 7.3.8-1.fc30 updates 4.3 M
php-common x86_64 7.3.8-1.fc30 updates 1.1 M
Installing weak dependencies:
php-fpm x86_64 7.3.8-1.fc30 updates 1.5 M
Transaction Summary
=============================================================================
Install 5 Packages
Total download size: 9.6 M
Installed size: 43 M
Downloading Packages:
(1/5): nginx-filesystem-1.16.0-3.fc30.noarch 34 kB/s | 11 kB 00:00
(2/5): php-common-7.3.8-1.fc30.x86_64.rpm 1.1 MB/s | 1.1 MB 00:00
(3/5): php-7.3.8-1.fc30.x86_64.rpm 2.0 MB/s | 2.8 MB 00:01
(4/5): php-fpm-7.3.8-1.fc30.x86_64.rpm 2.2 MB/s | 1.5 MB 00:00
(5/5): php-cli-7.3.8-1.fc30.x86_64.rpm 1.7 MB/s | 4.3 MB 00:02
-----------------------------------------------------------------------------
Total 3.0 MB/s | 9.6 MB 00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php-common-7.3.8-1.fc30.x86_64 1/5
Installing : php-cli-7.3.8-1.fc30.x86_64 2/5
Running scriptlet: nginx-filesystem-1:1.16.0-3.fc30.noarch 3/5
Installing : nginx-filesystem-1:1.16.0-3.fc30.noarch 3/5
Installing : php-fpm-7.3.8-1.fc30.x86_64 4/5
Running scriptlet: php-fpm-7.3.8-1.fc30.x86_64 4/5
Installing : php-7.3.8-1.fc30.x86_64 5/5
Running scriptlet: php-7.3.8-1.fc30.x86_64 5/5
Running scriptlet: php-fpm-7.3.8-1.fc30.x86_64 5/5
Verifying : nginx-filesystem-1:1.16.0-3.fc30.noarch 1/5
Verifying : php-7.3.8-1.fc30.x86_64 2/5
Verifying : php-cli-7.3.8-1.fc30.x86_64 3/5
Verifying : php-common-7.3.8-1.fc30.x86_64 4/5
Verifying : php-fpm-7.3.8-1.fc30.x86_64 5/5
Installed:
php-7.3.8-1.fc30.x86_64 php-fpm-7.3.8-1.fc30.x86_64
nginx-filesystem-1:1.16.0-3.fc30.noarch php-cli-7.3.8-1.fc30.x86_64
php-common-7.3.8-1.fc30.x86_64
Complete! |
Last metadata expiration check: 0:37:02 ago on Fri 16 Aug 2019 11:03:54 AM MDT.
Dependencies resolved.
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
php x86_64 7.3.8-1.fc30 updates 2.8 M
Installing dependencies:
nginx-filesystem noarch 1:1.16.0-3.fc30 updates 11 k
php-cli x86_64 7.3.8-1.fc30 updates 4.3 M
php-common x86_64 7.3.8-1.fc30 updates 1.1 M
Installing weak dependencies:
php-fpm x86_64 7.3.8-1.fc30 updates 1.5 M
Transaction Summary
=============================================================================
Install 5 Packages
Total download size: 9.6 M
Installed size: 43 M
Downloading Packages:
(1/5): nginx-filesystem-1.16.0-3.fc30.noarch 34 kB/s | 11 kB 00:00
(2/5): php-common-7.3.8-1.fc30.x86_64.rpm 1.1 MB/s | 1.1 MB 00:00
(3/5): php-7.3.8-1.fc30.x86_64.rpm 2.0 MB/s | 2.8 MB 00:01
(4/5): php-fpm-7.3.8-1.fc30.x86_64.rpm 2.2 MB/s | 1.5 MB 00:00
(5/5): php-cli-7.3.8-1.fc30.x86_64.rpm 1.7 MB/s | 4.3 MB 00:02
-----------------------------------------------------------------------------
Total 3.0 MB/s | 9.6 MB 00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php-common-7.3.8-1.fc30.x86_64 1/5
Installing : php-cli-7.3.8-1.fc30.x86_64 2/5
Running scriptlet: nginx-filesystem-1:1.16.0-3.fc30.noarch 3/5
Installing : nginx-filesystem-1:1.16.0-3.fc30.noarch 3/5
Installing : php-fpm-7.3.8-1.fc30.x86_64 4/5
Running scriptlet: php-fpm-7.3.8-1.fc30.x86_64 4/5
Installing : php-7.3.8-1.fc30.x86_64 5/5
Running scriptlet: php-7.3.8-1.fc30.x86_64 5/5
Running scriptlet: php-fpm-7.3.8-1.fc30.x86_64 5/5
Verifying : nginx-filesystem-1:1.16.0-3.fc30.noarch 1/5
Verifying : php-7.3.8-1.fc30.x86_64 2/5
Verifying : php-cli-7.3.8-1.fc30.x86_64 3/5
Verifying : php-common-7.3.8-1.fc30.x86_64 4/5
Verifying : php-fpm-7.3.8-1.fc30.x86_64 5/5
Installed:
php-7.3.8-1.fc30.x86_64 php-fpm-7.3.8-1.fc30.x86_64
nginx-filesystem-1:1.16.0-3.fc30.noarch php-cli-7.3.8-1.fc30.x86_64
php-common-7.3.8-1.fc30.x86_64
Complete!
Before you test the installation of PHP in a browser, you must restart the Apache HTTP Server. You can do that with the following command as a privileged user:
After verifying the connection, you can test it by creating the traditional info.php
program file in the /var/www/http
directory. The file should contain the following:
1
2
3
| <?php
phpinfo();
?> |
<?php
phpinfo();
?>
It should display the PHP Version 7.3.8 web page, which ships with Fedora 30:

The next step shows you how to install mysqli
and pdo
with the yum
utility. While it’s unnecessary to check for the older mysql
library (truly deprecated), its good practice to know how to check for a conflicting library before installing a new one. Also, I’d prefer newbies get exposed to using the yum
utility’s shell environment.
You start the yum shell, as follows:
With the yum
shell, you would remove a mysql
package with the following command:
The command will remove the package or tell you that there is no package to remove. Next, you install the php-mysqli
package with this command:
You will then be prompted to confirm the installation of the php-mysqli
library. Finally, you exit the yum
shell with this command:
If you want to see the whole interactive shell, click on the link below.
Display detailed console log →
Last metadata expiration check: 0:53:05 ago on Fri 16 Aug 2019 11:03:54 AM MDT.
> remove php-mysql
No match for argument: php-mysql
No packages marked for removal.
> install php-mysqlnd
> run
=============================================================================
Package Architecture Version Repository Size
=============================================================================
Installing:
php-mysqlnd x86_64 7.3.8-1.fc30 updates 195 k
Installing dependencies:
php-pdo x86_64 7.3.8-1.fc30 updates 91 k
Transaction Summary
=============================================================================
Install 2 Packages
Total download size: 286 k
Installed size: 1.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): php-pdo-7.3.8-1.fc30.x86_64.rpm 136 kB/s | 91 kB 00:00
(2/2): php-mysqlnd-7.3.8-1.fc30.x86_64.rpm 183 kB/s | 195 kB 00:01
-----------------------------------------------------------------------------
Total 24 kB/s | 286 kB 00:11
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php-pdo-7.3.8-1.fc30.x86_64 1/2
Installing : php-mysqlnd-7.3.8-1.fc30.x86_64 2/2
Running scriptlet: php-mysqlnd-7.3.8-1.fc30.x86_64 2/2
Verifying : php-mysqlnd-7.3.8-1.fc30.x86_64 1/2
Verifying : php-pdo-7.3.8-1.fc30.x86_64 2/2
Installed:
php-mysqlnd-7.3.8-1.fc30.x86_64 php-pdo-7.3.8-1.fc30.x86_64
Last metadata expiration check: 0:53:54 ago on Fri 16 Aug 2019 11:03:54 AM MDT.
> quit
Leaving Shell
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'. |
Last metadata expiration check: 0:53:05 ago on Fri 16 Aug 2019 11:03:54 AM MDT.
> remove php-mysql
No match for argument: php-mysql
No packages marked for removal.
> install php-mysqlnd
> run
=============================================================================
Package Architecture Version Repository Size
=============================================================================
Installing:
php-mysqlnd x86_64 7.3.8-1.fc30 updates 195 k
Installing dependencies:
php-pdo x86_64 7.3.8-1.fc30 updates 91 k
Transaction Summary
=============================================================================
Install 2 Packages
Total download size: 286 k
Installed size: 1.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): php-pdo-7.3.8-1.fc30.x86_64.rpm 136 kB/s | 91 kB 00:00
(2/2): php-mysqlnd-7.3.8-1.fc30.x86_64.rpm 183 kB/s | 195 kB 00:01
-----------------------------------------------------------------------------
Total 24 kB/s | 286 kB 00:11
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php-pdo-7.3.8-1.fc30.x86_64 1/2
Installing : php-mysqlnd-7.3.8-1.fc30.x86_64 2/2
Running scriptlet: php-mysqlnd-7.3.8-1.fc30.x86_64 2/2
Verifying : php-mysqlnd-7.3.8-1.fc30.x86_64 1/2
Verifying : php-pdo-7.3.8-1.fc30.x86_64 2/2
Installed:
php-mysqlnd-7.3.8-1.fc30.x86_64 php-pdo-7.3.8-1.fc30.x86_64
Last metadata expiration check: 0:53:54 ago on Fri 16 Aug 2019 11:03:54 AM MDT.
> quit
Leaving Shell
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
You need to restart the Apache HTTP listener for these changes to take place, which you do with the same command as shown earlier:
I wrote the mysqli_check.php
script to verify installation of both the mysqli
and pdo
libraries. The full code should be put in a mysqli_check.php
file in the /var/www/html
directory for testing.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| <html>
<header>
<title>Static Query Object Sample</title>
<style type="text/css">
/* HTML element styles. */
table {background:white;border-style:solid;border-width:3px;border-color:black;border-collapse:collapse;}
th {text-align:center;font-style:bold;background:lightgray;border:solid 1px gray;}
td {border:solid 1px gray;}
/* Class tag element styles. */
.ID {min-width:50px;text-align:right;}
.Label {min-width:200px;text-align:left;}
</style>
</header>
<body>
<?php
if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
print 'mysqli not installed.'; }
else {
print 'mysqli installed.'; }
if (!function_exists('pdo_init') && !extension_loaded('pdo')) {
print '<p>pdo not installed.</p>'; }
else {
print '<p>pdo installed.</p>'; }
?>
</script>
</body>
</html> |
<html>
<header>
<title>Static Query Object Sample</title>
<style type="text/css">
/* HTML element styles. */
table {background:white;border-style:solid;border-width:3px;border-color:black;border-collapse:collapse;}
th {text-align:center;font-style:bold;background:lightgray;border:solid 1px gray;}
td {border:solid 1px gray;}
/* Class tag element styles. */
.ID {min-width:50px;text-align:right;}
.Label {min-width:200px;text-align:left;}
</style>
</header>
<body>
<?php
if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
print 'mysqli not installed.'; }
else {
print 'mysqli installed.'; }
if (!function_exists('pdo_init') && !extension_loaded('pdo')) {
print '<p>pdo not installed.</p>'; }
else {
print '<p>pdo installed.</p>'; }
?>
</script>
</body>
</html>
You can test it with the following URL from the local browser:
http://localhost/mysqli_check.php |
http://localhost/mysqli_check.php
It should print the following to the web page when you’ve successfully install the mysqli
and pdo
libraries:
mysqli installed.
pdo installed. |
mysqli installed.
pdo installed.
If you plan to use PHP to display and render graphics, you need to install php-gd
library. You can do that with the yum
utility and this prior blog post explains it. Don’t forget to restart the Apache HTTP Server after you add the php-gd
library.
For example, one of my sample PHP programs loads a PNG image into a BLOB
column as raw binary text. Then, the program reads it and renders it with PHP to produce the following web page.

As always, I hope this helps those looking for a complete solution without cost.
While updating my class image to Fedora 30, I noticed that it installed the Akonadi Server. The documentation on the Akonadi server lacked some straightforward documentation. It also offered a bundled set of software that limited how to approach MySQL development.
So, I removed all those packages with the following syntax:
dnf remove `rpm -qa | grep akonadi` |
dnf remove `rpm -qa | grep akonadi`
Display detailed console log →
Dependencies resolved.
=============================================================================
Package Arch Version Repo Size
=============================================================================
Removing:
akonadi-import-wizard x86_64 19.04.2-1.fc30 @updates 2.8 M
kf5-akonadi-calendar x86_64 19.04.2-1.fc30 @updates 2.6 M
kf5-akonadi-contacts x86_64 19.04.2-1.fc30 @updates 3.3 M
kf5-akonadi-mime x86_64 19.04.2-1.fc30 @updates 1.1 M
kf5-akonadi-notes x86_64 19.04.2-1.fc30 @updates 170 k
kf5-akonadi-search x86_64 19.04.2-1.fc30 @updates 1.6 M
kf5-akonadi-server x86_64 19.04.2-2.fc30 @updates 14 M
kf5-akonadi-server-mysql x86_64 19.04.2-2.fc30 @updates 3.4 k
kf5-kmailtransport-akonadi x86_64 19.04.2-1.fc30 @updates 204 k
kf5-libkdepim-akonadi x86_64 19.04.2-1.fc30 @updates 973 k
kf5-mailimporter-akonadi x86_64 19.04.2-1.fc30 @updates 106 k
kf5-pimcommon-akonadi x86_64 19.04.2-1.fc30 @updates 542 k
Removing dependent packages:
akregator x86_64 19.04.2-1.fc30 @updates 3.9 M
akregator-libs x86_64 19.04.2-1.fc30 @updates 3.3 M
digikam x86_64 6.1.0-7.fc30 @updates 149 M
digikam-libs x86_64 6.1.0-7.fc30 @updates 47 M
kgpg x86_64 18.12.2-1.fc30 @fedora 8.0 M
kontact x86_64 19.04.2-1.fc30 @updates 1.6 M
Removing unused dependencies:
CharLS x86_64 1.0-18.fc30 @fedora 341 k
coin-or-Clp x86_64 1.16.10-8.fc30 @fedora 2.8 M
coin-or-CoinUtils x86_64 2.10.14-3.fc30 @fedora 1.5 M
coin-or-Osi x86_64 0.107.8-9.fc30 @fedora 1.1 M
digikam-doc noarch 6.1.0-7.fc30 @updates 0
enblend x86_64 4.2-10.fc29 @fedora 4.9 M
gdcm x86_64 2.8.8-4.fc30 @fedora 11 M
grantlee-editor x86_64 19.04.2-1.fc30 @updates 1.4 M
grantlee-editor-libs x86_64 19.04.2-1.fc30 @updates 208 k
hugin-base x86_64 2019.0.0-1.fc30 @updates 28 M
kaddressbook x86_64 19.04.2-1.fc30 @updates 758 k
kaddressbook-libs x86_64 19.04.2-1.fc30 @updates 847 k
kdepim-addons x86_64 19.04.2-1.fc30 @updates 11 M
kdepim-apps-libs x86_64 19.04.2-1.fc30 @updates 1.1 M
kdepim-runtime x86_64 1:19.04.2-1.fc30 @updates 20 M
kdepim-runtime-libs x86_64 1:19.04.2-1.fc30 @updates 2.6 M
kf5-calendarsupport x86_64 19.04.2-1.fc30 @updates 3.4 M
kf5-eventviews x86_64 19.04.2-1.fc30 @updates 3.7 M
kf5-grantleetheme x86_64 19.04.2-1.fc30 @updates 283 k
kf5-incidenceeditor x86_64 19.04.2-1.fc30 @updates 3.4 M
kf5-kalarmcal x86_64 19.04.2-1.fc30 @updates 1.1 M
kf5-kcalendarcore x86_64 19.04.2-1.fc30 @updates 1.4 M
kf5-kcalendarutils x86_64 19.04.2-1.fc30 @updates 1.9 M
kf5-kcontacts x86_64 19.04.2-1.fc30 @updates 2.1 M
kf5-kdav x86_64 19.04.2-1.fc30 @updates 591 k
kf5-kidentitymanagement x86_64 19.04.2-1.fc30 @updates 511 k
kf5-kimap x86_64 19.04.2-1.fc30 @updates 1.3 M
kf5-kitinerary x86_64 19.04.2-1.fc30 @updates 1.8 M
kf5-kldap x86_64 19.04.2-1.fc30 @updates 885 k
kf5-kmailtransport x86_64 19.04.2-1.fc30 @updates 1.2 M
kf5-kmbox x86_64 19.04.2-1.fc30 @updates 116 k
kf5-kmime x86_64 19.04.2-1.fc30 @updates 798 k
kf5-kontactinterface x86_64 19.04.2-1.fc30 @updates 242 k
kf5-kpimtextedit x86_64 19.04.2-2.fc30 @updates 1.3 M
kf5-kpkpass x86_64 19.04.2-1.fc30 @updates 172 k
kf5-ksmtp x86_64 19.04.2-1.fc30 @updates 258 k
kf5-ktnef x86_64 19.04.2-1.fc30 @updates 650 k
kf5-libgravatar x86_64 19.04.2-1.fc30 @updates 247 k
kf5-libkdepim x86_64 19.04.2-1.fc30 @updates 1.6 M
kf5-libkleo x86_64 19.04.2-1.fc30 @updates 2.7 M
kf5-libksieve x86_64 19.04.2-1.fc30 @updates 5.2 M
kf5-mailcommon x86_64 19.04.2-1.fc30 @updates 4.6 M
kf5-mailimporter x86_64 19.04.2-1.fc30 @updates 1.5 M
kf5-messagelib x86_64 19.04.2-1.fc30 @updates 18 M
kf5-pimcommon x86_64 19.04.2-1.fc30 @updates 1.9 M
kmail x86_64 19.04.2-2.fc30 @updates 14 M
kmail-account-wizard x86_64 19.04.2-1.fc30 @updates 3.3 M
kmail-libs x86_64 19.04.2-2.fc30 @updates 5.5 M
kontact-libs x86_64 19.04.2-1.fc30 @updates 433 k
korganizer x86_64 19.04.2-1.fc30 @updates 7.3 M
korganizer-libs x86_64 19.04.2-1.fc30 @updates 3.9 M
lensfun x86_64 0.3.2-19.fc30 @fedora 2.0 M
libdc1394 x86_64 2.2.2-12.fc30 @fedora 379 k
libical x86_64 3.0.4-3.fc30 @fedora 1.8 M
libkgapi x86_64 19.04.2-1.fc30 @updates 3.6 M
libkolabxml x86_64 1.1.6-10.fc30 @fedora 3.9 M
liblqr-1 x86_64 0.4.2-12.fc30 @fedora 120 k
libpano13 x86_64 2.9.19-9.fc30 @fedora 672 k
libucil x86_64 0.9.10-18.fc30 @fedora 217 k
libunicap x86_64 0.9.12-23.fc30 @fedora 485 k
libva x86_64 2.4.1-1.fc30 @fedora 284 k
mariadb x86_64 3:10.3.16-1.fc30 @updates 39 M
mariadb-backup x86_64 3:10.3.16-1.fc30 @updates 27 M
mariadb-common x86_64 3:10.3.16-1.fc30 @updates 179 k
mariadb-cracklib-password-check x86_64 3:10.3.16-1.fc30 @updates 21 k
mariadb-errmsg x86_64 3:10.3.16-1.fc30 @updates 2.3 M
mariadb-gssapi-server x86_64 3:10.3.16-1.fc30 @updates 28 k
mariadb-server x86_64 3:10.3.16-1.fc30 @updates 96 M
mariadb-server-utils x86_64 3:10.3.16-1.fc30 @updates 7.4 M
mesa-libOSMesa x86_64 19.1.3-1.fc30 @updates 9.6 M
netcdf-cxx x86_64 4.2-21.fc30 @fedora 153 k
opencv-contrib x86_64 3.4.4-10.fc30 @updates 19 M
opencv-core x86_64 3.4.4-10.fc30 @updates 20 M
openni x86_64 1.5.7.10-15.fc30 @updates 2.7 M
perl-DBD-MySQL x86_64 4.050-2.fc30 @fedora 367 k
perl-Image-ExifTool noarch 11.50-1.fc30 @updates 14 M
pim-data-exporter x86_64 19.04.2-1.fc30 @updates 1.2 M
pim-data-exporter-libs x86_64 19.04.2-1.fc30 @updates 738 k
pim-sieve-editor x86_64 19.04.2-1.fc30 @updates 1.7 M
protobuf x86_64 3.6.1-3.fc30 @fedora 3.8 M
qt5-qtbase-mysql x86_64 5.12.4-4.fc30 @updates 96 k
tinyxml x86_64 2.6.2-18.fc30 @fedora 156 k
vigra x86_64 1.11.1-13.fc30 @fedora 714 k
vtk x86_64 8.1.1-5.fc30 @updates 100 M
Transaction Summary
=============================================================================
Remove 102 Packages
Freed space: 783 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: opencv-contrib-3.4.4-10.fc30.x86_64 1/1
Erasing : opencv-contrib-3.4.4-10.fc30.x86_64 1/102
Erasing : kontact-19.04.2-1.fc30.x86_64 2/102
Erasing : kmail-19.04.2-2.fc30.x86_64 3/102
Erasing : kmail-libs-19.04.2-2.fc30.x86_64 4/102
Erasing : korganizer-19.04.2-1.fc30.x86_64 5/102
Erasing : korganizer-libs-19.04.2-1.fc30.x86_64 6/102
Erasing : kmail-account-wizard-19.04.2-1.fc30.x86_64 7/102
Erasing : grantlee-editor-19.04.2-1.fc30.x86_64 8/102
Erasing : pim-data-exporter-19.04.2-1.fc30.x86_64 9/102
Erasing : pim-data-exporter-libs-19.04.2-1.fc30.x86_64 10/102
Erasing : digikam-6.1.0-7.fc30.x86_64 11/102
Erasing : digikam-libs-6.1.0-7.fc30.x86_64 12/102
Erasing : opencv-core-3.4.4-10.fc30.x86_64 13/102
Erasing : kaddressbook-19.04.2-1.fc30.x86_64 14/102
Erasing : kdepim-addons-19.04.2-1.fc30.x86_64 15/102
Erasing : kdepim-runtime-1:19.04.2-1.fc30.x86_64 16/102
Erasing : kf5-incidenceeditor-19.04.2-1.fc30.x86_64 17/102
Erasing : kaddressbook-libs-19.04.2-1.fc30.x86_64 18/102
Erasing : kdepim-runtime-libs-1:19.04.2-1.fc30.x86_64 19/102
Erasing : akonadi-import-wizard-19.04.2-1.fc30.x86_64 20/102
Erasing : kf5-mailcommon-19.04.2-1.fc30.x86_64 21/102
Erasing : kf5-eventviews-19.04.2-1.fc30.x86_64 22/102
Erasing : kf5-calendarsupport-19.04.2-1.fc30.x86_64 23/102
Erasing : kf5-akonadi-calendar-19.04.2-1.fc30.x86_64 24/102
Erasing : akregator-19.04.2-1.fc30.x86_64 25/102
Erasing : akregator-libs-19.04.2-1.fc30.x86_64 26/102
Erasing : kf5-messagelib-19.04.2-1.fc30.x86_64 27/102
Erasing : kf5-pimcommon-akonadi-19.04.2-1.fc30.x86_64 28/102
Erasing : kf5-libkdepim-akonadi-19.04.2-1.fc30.x86_64 29/102
Erasing : kdepim-apps-libs-19.04.2-1.fc30.x86_64 30/102
Erasing : kf5-akonadi-search-19.04.2-1.fc30.x86_64 31/102
Erasing : kf5-mailimporter-akonadi-19.04.2-1.fc30.x86_6 32/102
Erasing : kf5-kalarmcal-19.04.2-1.fc30.x86_64 33/102
Erasing : kf5-kitinerary-19.04.2-1.fc30.x86_64 34/102
Erasing : hugin-base-2019.0.0-1.fc30.x86_64 35/102
Erasing : pim-sieve-editor-19.04.2-1.fc30.x86_64 36/102
Erasing : kf5-kmailtransport-19.04.2-1.fc30.x86_64 37/102
Erasing : kf5-libksieve-19.04.2-1.fc30.x86_64 38/102
Erasing : kf5-ktnef-19.04.2-1.fc30.x86_64 39/102
Erasing : kontact-libs-19.04.2-1.fc30.x86_64 40/102
Erasing : kgpg-18.12.2-1.fc30.x86_64 41/102
Erasing : kf5-akonadi-contacts-19.04.2-1.fc30.x86_64 42/102
Erasing : kf5-kcalendarutils-19.04.2-1.fc30.x86_64 43/102
Erasing : kf5-kmailtransport-akonadi-19.04.2-1.fc30.x86 44/102
Erasing : kf5-akonadi-mime-19.04.2-1.fc30.x86_64 45/102
Erasing : libkgapi-19.04.2-1.fc30.x86_64 46/102
Erasing : kf5-kcalendarcore-19.04.2-1.fc30.x86_64 47/102
Erasing : coin-or-Clp-1.16.10-8.fc30.x86_64 48/102
Erasing : vtk-8.1.1-5.fc30.x86_64 49/102
Erasing : coin-or-Osi-0.107.8-9.fc30.x86_64 50/102
Erasing : kf5-akonadi-server-19.04.2-2.fc30.x86_64 51/102
Running scriptlet: kf5-akonadi-server-19.04.2-2.fc30.x86_64 51/102
Erasing : kf5-akonadi-server-mysql-19.04.2-2.fc30.x86_6 52/102
Running scriptlet: kf5-akonadi-server-mysql-19.04.2-2.fc30.x86_6 52/102
Erasing : kf5-kidentitymanagement-19.04.2-1.fc30.x86_64 53/102
Erasing : enblend-4.2-10.fc29.x86_64 54/102
Erasing : kf5-mailimporter-19.04.2-1.fc30.x86_64 55/102
Erasing : kf5-libkleo-19.04.2-1.fc30.x86_64 56/102
Erasing : kf5-kimap-19.04.2-1.fc30.x86_64 57/102
Erasing : kf5-libgravatar-19.04.2-1.fc30.x86_64 58/102
Erasing : kf5-pimcommon-19.04.2-1.fc30.x86_64 59/102
Erasing : kf5-libkdepim-19.04.2-1.fc30.x86_64 60/102
Erasing : kf5-kmbox-19.04.2-1.fc30.x86_64 61/102
Erasing : kf5-akonadi-notes-19.04.2-1.fc30.x86_64 62/102
Running scriptlet: openni-1.5.7.10-15.fc30.x86_64 63/102
Erasing : openni-1.5.7.10-15.fc30.x86_64 63/102
Erasing : gdcm-2.8.8-4.fc30.x86_64 64/102
Erasing : libucil-0.9.10-18.fc30.x86_64 65/102
Erasing : grantlee-editor-libs-19.04.2-1.fc30.x86_64 66/102
Erasing : mariadb-gssapi-server-3:10.3.16-1.fc30.x86_64 67/102
Erasing : libunicap-0.9.12-23.fc30.x86_64 68/102
Erasing : perl-Image-ExifTool-11.50-1.fc30.noarch 69/102
Erasing : libkolabxml-1.1.6-10.fc30.x86_64 70/102
Erasing : digikam-doc-6.1.0-7.fc30.noarch 71/102
Erasing : mariadb-3:10.3.16-1.fc30.x86_64 72/102
Erasing : mariadb-backup-3:10.3.16-1.fc30.x86_64 73/102
Erasing : mariadb-cracklib-password-check-3:10.3.16-1.f 74/102
Running scriptlet: mariadb-server-3:10.3.16-1.fc30.x86_64 75/102
Erasing : mariadb-server-3:10.3.16-1.fc30.x86_64 75/102
Running scriptlet: mariadb-server-3:10.3.16-1.fc30.x86_64 75/102
Erasing : mariadb-errmsg-3:10.3.16-1.fc30.x86_64 76/102
Erasing : mariadb-server-utils-3:10.3.16-1.fc30.x86_64 77/102
Erasing : mariadb-common-3:10.3.16-1.fc30.x86_64 78/102
Erasing : perl-DBD-MySQL-4.050-2.fc30.x86_64 79/102
Erasing : kf5-kpimtextedit-19.04.2-2.fc30.x86_64 80/102
Erasing : CharLS-1.0-18.fc30.x86_64 81/102
Erasing : tinyxml-2.6.2-18.fc30.x86_64 82/102
Erasing : kf5-kmime-19.04.2-1.fc30.x86_64 83/102
Erasing : kf5-kcontacts-19.04.2-1.fc30.x86_64 84/102
Erasing : kf5-kldap-19.04.2-1.fc30.x86_64 85/102
Erasing : vigra-1.11.1-13.fc30.x86_64 86/102
Erasing : qt5-qtbase-mysql-5.12.4-4.fc30.x86_64 87/102
Erasing : coin-or-CoinUtils-2.10.14-3.fc30.x86_64 88/102
Erasing : mesa-libOSMesa-19.1.3-1.fc30.x86_64 89/102
Erasing : netcdf-cxx-4.2-21.fc30.x86_64 90/102
Running scriptlet: netcdf-cxx-4.2-21.fc30.x86_64 90/102
Erasing : libical-3.0.4-3.fc30.x86_64 91/102
Erasing : kf5-grantleetheme-19.04.2-1.fc30.x86_64 92/102
Erasing : kf5-kontactinterface-19.04.2-1.fc30.x86_64 93/102
Erasing : kf5-ksmtp-19.04.2-1.fc30.x86_64 94/102
Erasing : libpano13-2.9.19-9.fc30.x86_64 95/102
Erasing : kf5-kpkpass-19.04.2-1.fc30.x86_64 96/102
Erasing : kf5-kdav-19.04.2-1.fc30.x86_64 97/102
Erasing : libdc1394-2.2.2-12.fc30.x86_64 98/102
Erasing : libva-2.4.1-1.fc30.x86_64 99/102
Erasing : lensfun-0.3.2-19.fc30.x86_64 100/102
Erasing : liblqr-1-0.4.2-12.fc30.x86_64 101/102
Erasing : protobuf-3.6.1-3.fc30.x86_64 102/102
Running scriptlet: protobuf-3.6.1-3.fc30.x86_64 102/102
Verifying : CharLS-1.0-18.fc30.x86_64 1/102
Verifying : akonadi-import-wizard-19.04.2-1.fc30.x86_64 2/102
Verifying : akregator-19.04.2-1.fc30.x86_64 3/102
Verifying : akregator-libs-19.04.2-1.fc30.x86_64 4/102
Verifying : coin-or-Clp-1.16.10-8.fc30.x86_64 5/102
Verifying : coin-or-CoinUtils-2.10.14-3.fc30.x86_64 6/102
Verifying : coin-or-Osi-0.107.8-9.fc30.x86_64 7/102
Verifying : digikam-6.1.0-7.fc30.x86_64 8/102
Verifying : digikam-doc-6.1.0-7.fc30.noarch 9/102
Verifying : digikam-libs-6.1.0-7.fc30.x86_64 10/102
Verifying : enblend-4.2-10.fc29.x86_64 11/102
Verifying : gdcm-2.8.8-4.fc30.x86_64 12/102
Verifying : grantlee-editor-19.04.2-1.fc30.x86_64 13/102
Verifying : grantlee-editor-libs-19.04.2-1.fc30.x86_64 14/102
Verifying : hugin-base-2019.0.0-1.fc30.x86_64 15/102
Verifying : kaddressbook-19.04.2-1.fc30.x86_64 16/102
Verifying : kaddressbook-libs-19.04.2-1.fc30.x86_64 17/102
Verifying : kdepim-addons-19.04.2-1.fc30.x86_64 18/102
Verifying : kdepim-apps-libs-19.04.2-1.fc30.x86_64 19/102
Verifying : kdepim-runtime-1:19.04.2-1.fc30.x86_64 20/102
Verifying : kdepim-runtime-libs-1:19.04.2-1.fc30.x86_64 21/102
Verifying : kf5-akonadi-calendar-19.04.2-1.fc30.x86_64 22/102
Verifying : kf5-akonadi-contacts-19.04.2-1.fc30.x86_64 23/102
Verifying : kf5-akonadi-mime-19.04.2-1.fc30.x86_64 24/102
Verifying : kf5-akonadi-notes-19.04.2-1.fc30.x86_64 25/102
Verifying : kf5-akonadi-search-19.04.2-1.fc30.x86_64 26/102
Verifying : kf5-akonadi-server-19.04.2-2.fc30.x86_64 27/102
Verifying : kf5-akonadi-server-mysql-19.04.2-2.fc30.x86_6 28/102
Verifying : kf5-calendarsupport-19.04.2-1.fc30.x86_64 29/102
Verifying : kf5-eventviews-19.04.2-1.fc30.x86_64 30/102
Verifying : kf5-grantleetheme-19.04.2-1.fc30.x86_64 31/102
Verifying : kf5-incidenceeditor-19.04.2-1.fc30.x86_64 32/102
Verifying : kf5-kalarmcal-19.04.2-1.fc30.x86_64 33/102
Verifying : kf5-kcalendarcore-19.04.2-1.fc30.x86_64 34/102
Verifying : kf5-kcalendarutils-19.04.2-1.fc30.x86_64 35/102
Verifying : kf5-kcontacts-19.04.2-1.fc30.x86_64 36/102
Verifying : kf5-kdav-19.04.2-1.fc30.x86_64 37/102
Verifying : kf5-kidentitymanagement-19.04.2-1.fc30.x86_64 38/102
Verifying : kf5-kimap-19.04.2-1.fc30.x86_64 39/102
Verifying : kf5-kitinerary-19.04.2-1.fc30.x86_64 40/102
Verifying : kf5-kldap-19.04.2-1.fc30.x86_64 41/102
Verifying : kf5-kmailtransport-19.04.2-1.fc30.x86_64 42/102
Verifying : kf5-kmailtransport-akonadi-19.04.2-1.fc30.x86 43/102
Verifying : kf5-kmbox-19.04.2-1.fc30.x86_64 44/102
Verifying : kf5-kmime-19.04.2-1.fc30.x86_64 45/102
Verifying : kf5-kontactinterface-19.04.2-1.fc30.x86_64 46/102
Verifying : kf5-kpimtextedit-19.04.2-2.fc30.x86_64 47/102
Verifying : kf5-kpkpass-19.04.2-1.fc30.x86_64 48/102
Verifying : kf5-ksmtp-19.04.2-1.fc30.x86_64 49/102
Verifying : kf5-ktnef-19.04.2-1.fc30.x86_64 50/102
Verifying : kf5-libgravatar-19.04.2-1.fc30.x86_64 51/102
Verifying : kf5-libkdepim-19.04.2-1.fc30.x86_64 52/102
Verifying : kf5-libkdepim-akonadi-19.04.2-1.fc30.x86_64 53/102
Verifying : kf5-libkleo-19.04.2-1.fc30.x86_64 54/102
Verifying : kf5-libksieve-19.04.2-1.fc30.x86_64 55/102
Verifying : kf5-mailcommon-19.04.2-1.fc30.x86_64 56/102
Verifying : kf5-mailimporter-19.04.2-1.fc30.x86_64 57/102
Verifying : kf5-mailimporter-akonadi-19.04.2-1.fc30.x86_6 58/102
Verifying : kf5-messagelib-19.04.2-1.fc30.x86_64 59/102
Verifying : kf5-pimcommon-19.04.2-1.fc30.x86_64 60/102
Verifying : kf5-pimcommon-akonadi-19.04.2-1.fc30.x86_64 61/102
Verifying : kgpg-18.12.2-1.fc30.x86_64 62/102
Verifying : kmail-19.04.2-2.fc30.x86_64 63/102
Verifying : kmail-account-wizard-19.04.2-1.fc30.x86_64 64/102
Verifying : kmail-libs-19.04.2-2.fc30.x86_64 65/102
Verifying : kontact-19.04.2-1.fc30.x86_64 66/102
Verifying : kontact-libs-19.04.2-1.fc30.x86_64 67/102
Verifying : korganizer-19.04.2-1.fc30.x86_64 68/102
Verifying : korganizer-libs-19.04.2-1.fc30.x86_64 69/102
Verifying : lensfun-0.3.2-19.fc30.x86_64 70/102
Verifying : libdc1394-2.2.2-12.fc30.x86_64 71/102
Verifying : libical-3.0.4-3.fc30.x86_64 72/102
Verifying : libkgapi-19.04.2-1.fc30.x86_64 73/102
Verifying : libkolabxml-1.1.6-10.fc30.x86_64 74/102
Verifying : liblqr-1-0.4.2-12.fc30.x86_64 75/102
Verifying : libpano13-2.9.19-9.fc30.x86_64 76/102
Verifying : libucil-0.9.10-18.fc30.x86_64 77/102
Verifying : libunicap-0.9.12-23.fc30.x86_64 78/102
Verifying : libva-2.4.1-1.fc30.x86_64 79/102
Verifying : mariadb-3:10.3.16-1.fc30.x86_64 80/102
Verifying : mariadb-backup-3:10.3.16-1.fc30.x86_64 81/102
Verifying : mariadb-common-3:10.3.16-1.fc30.x86_64 82/102
Verifying : mariadb-cracklib-password-check-3:10.3.16-1.f 83/102
Verifying : mariadb-errmsg-3:10.3.16-1.fc30.x86_64 84/102
Verifying : mariadb-gssapi-server-3:10.3.16-1.fc30.x86_64 85/102
Verifying : mariadb-server-3:10.3.16-1.fc30.x86_64 86/102
Verifying : mariadb-server-utils-3:10.3.16-1.fc30.x86_64 87/102
Verifying : mesa-libOSMesa-19.1.3-1.fc30.x86_64 88/102
Verifying : netcdf-cxx-4.2-21.fc30.x86_64 89/102
Verifying : opencv-contrib-3.4.4-10.fc30.x86_64 90/102
Verifying : opencv-core-3.4.4-10.fc30.x86_64 91/102
Verifying : openni-1.5.7.10-15.fc30.x86_64 92/102
Verifying : perl-DBD-MySQL-4.050-2.fc30.x86_64 93/102
Verifying : perl-Image-ExifTool-11.50-1.fc30.noarch 94/102
Verifying : pim-data-exporter-19.04.2-1.fc30.x86_64 95/102
Verifying : pim-data-exporter-libs-19.04.2-1.fc30.x86_64 96/102
Verifying : pim-sieve-editor-19.04.2-1.fc30.x86_64 97/102
Verifying : protobuf-3.6.1-3.fc30.x86_64 98/102
Verifying : qt5-qtbase-mysql-5.12.4-4.fc30.x86_64 99/102
Verifying : tinyxml-2.6.2-18.fc30.x86_64 100/102
Verifying : vigra-1.11.1-13.fc30.x86_64 101/102
Verifying : vtk-8.1.1-5.fc30.x86_64 102/102
Removed:
akonadi-import-wizard-19.04.2-1.fc30.x86_64
kf5-akonadi-calendar-19.04.2-1.fc30.x86_64
kf5-akonadi-contacts-19.04.2-1.fc30.x86_64
kf5-akonadi-mime-19.04.2-1.fc30.x86_64
kf5-akonadi-notes-19.04.2-1.fc30.x86_64
kf5-akonadi-search-19.04.2-1.fc30.x86_64
kf5-akonadi-server-19.04.2-2.fc30.x86_64
kf5-akonadi-server-mysql-19.04.2-2.fc30.x86_64
kf5-kmailtransport-akonadi-19.04.2-1.fc30.x86_64
kf5-libkdepim-akonadi-19.04.2-1.fc30.x86_64
kf5-mailimporter-akonadi-19.04.2-1.fc30.x86_64
kf5-pimcommon-akonadi-19.04.2-1.fc30.x86_64
akregator-19.04.2-1.fc30.x86_64
akregator-libs-19.04.2-1.fc30.x86_64
digikam-6.1.0-7.fc30.x86_64
digikam-libs-6.1.0-7.fc30.x86_64
kgpg-18.12.2-1.fc30.x86_64
kontact-19.04.2-1.fc30.x86_64
CharLS-1.0-18.fc30.x86_64
coin-or-Clp-1.16.10-8.fc30.x86_64
coin-or-CoinUtils-2.10.14-3.fc30.x86_64
coin-or-Osi-0.107.8-9.fc30.x86_64
digikam-doc-6.1.0-7.fc30.noarch
enblend-4.2-10.fc29.x86_64
gdcm-2.8.8-4.fc30.x86_64
grantlee-editor-19.04.2-1.fc30.x86_64
grantlee-editor-libs-19.04.2-1.fc30.x86_64
hugin-base-2019.0.0-1.fc30.x86_64
kaddressbook-19.04.2-1.fc30.x86_64
kaddressbook-libs-19.04.2-1.fc30.x86_64
kdepim-addons-19.04.2-1.fc30.x86_64
kdepim-apps-libs-19.04.2-1.fc30.x86_64
kdepim-runtime-1:19.04.2-1.fc30.x86_64
kdepim-runtime-libs-1:19.04.2-1.fc30.x86_64
kf5-calendarsupport-19.04.2-1.fc30.x86_64
kf5-eventviews-19.04.2-1.fc30.x86_64
kf5-grantleetheme-19.04.2-1.fc30.x86_64
kf5-incidenceeditor-19.04.2-1.fc30.x86_64
kf5-kalarmcal-19.04.2-1.fc30.x86_64
kf5-kcalendarcore-19.04.2-1.fc30.x86_64
kf5-kcalendarutils-19.04.2-1.fc30.x86_64
kf5-kcontacts-19.04.2-1.fc30.x86_64
kf5-kdav-19.04.2-1.fc30.x86_64
kf5-kidentitymanagement-19.04.2-1.fc30.x86_64
kf5-kimap-19.04.2-1.fc30.x86_64
kf5-kitinerary-19.04.2-1.fc30.x86_64
kf5-kldap-19.04.2-1.fc30.x86_64
kf5-kmailtransport-19.04.2-1.fc30.x86_64
kf5-kmbox-19.04.2-1.fc30.x86_64
kf5-kmime-19.04.2-1.fc30.x86_64
kf5-kontactinterface-19.04.2-1.fc30.x86_64
kf5-kpimtextedit-19.04.2-2.fc30.x86_64
kf5-kpkpass-19.04.2-1.fc30.x86_64
kf5-ksmtp-19.04.2-1.fc30.x86_64
kf5-ktnef-19.04.2-1.fc30.x86_64
kf5-libgravatar-19.04.2-1.fc30.x86_64
kf5-libkdepim-19.04.2-1.fc30.x86_64
kf5-libkleo-19.04.2-1.fc30.x86_64
kf5-libksieve-19.04.2-1.fc30.x86_64
kf5-mailcommon-19.04.2-1.fc30.x86_64
kf5-mailimporter-19.04.2-1.fc30.x86_64
kf5-messagelib-19.04.2-1.fc30.x86_64
kf5-pimcommon-19.04.2-1.fc30.x86_64
kmail-19.04.2-2.fc30.x86_64
kmail-account-wizard-19.04.2-1.fc30.x86_64
kmail-libs-19.04.2-2.fc30.x86_64
kontact-libs-19.04.2-1.fc30.x86_64
korganizer-19.04.2-1.fc30.x86_64
korganizer-libs-19.04.2-1.fc30.x86_64
lensfun-0.3.2-19.fc30.x86_64
libdc1394-2.2.2-12.fc30.x86_64
libical-3.0.4-3.fc30.x86_64
libkgapi-19.04.2-1.fc30.x86_64
libkolabxml-1.1.6-10.fc30.x86_64
liblqr-1-0.4.2-12.fc30.x86_64
libpano13-2.9.19-9.fc30.x86_64
libucil-0.9.10-18.fc30.x86_64
libunicap-0.9.12-23.fc30.x86_64
libva-2.4.1-1.fc30.x86_64
mariadb-3:10.3.16-1.fc30.x86_64
mariadb-backup-3:10.3.16-1.fc30.x86_64
mariadb-common-3:10.3.16-1.fc30.x86_64
mariadb-cracklib-password-check-3:10.3.16-1.fc30.x86_64
mariadb-errmsg-3:10.3.16-1.fc30.x86_64
mariadb-gssapi-server-3:10.3.16-1.fc30.x86_64
mariadb-server-3:10.3.16-1.fc30.x86_64
mariadb-server-utils-3:10.3.16-1.fc30.x86_64
mesa-libOSMesa-19.1.3-1.fc30.x86_64
netcdf-cxx-4.2-21.fc30.x86_64
opencv-contrib-3.4.4-10.fc30.x86_64
opencv-core-3.4.4-10.fc30.x86_64
openni-1.5.7.10-15.fc30.x86_64
perl-DBD-MySQL-4.050-2.fc30.x86_64
perl-Image-ExifTool-11.50-1.fc30.noarch
pim-data-exporter-19.04.2-1.fc30.x86_64
pim-data-exporter-libs-19.04.2-1.fc30.x86_64
pim-sieve-editor-19.04.2-1.fc30.x86_64
protobuf-3.6.1-3.fc30.x86_64
qt5-qtbase-mysql-5.12.4-4.fc30.x86_64
tinyxml-2.6.2-18.fc30.x86_64
vigra-1.11.1-13.fc30.x86_64
vtk-8.1.1-5.fc30.x86_64
Complete!
After removing those Akonadi packages, I installed the MySQL Community Edition from the Fedora repo with this syntax:
yum install -y community-mysql* |
yum install -y community-mysql*
Display detailed console log →
Last metadata expiration check: 1:03:17 ago on Thu 15 Aug 2019 11:01:30 PM MDT.
Dependencies resolved.
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
community-mysql x86_64 8.0.16-1.fc30 updates 10 M
community-mysql-devel x86_64 8.0.16-1.fc30 updates 89 k
community-mysql-errmsg x86_64 8.0.16-1.fc30 updates 487 k
community-mysql-test x86_64 8.0.16-1.fc30 updates 92 M
Installing dependencies:
community-mysql-common x86_64 8.0.16-1.fc30 updates 86 k
community-mysql-libs x86_64 8.0.16-1.fc30 updates 1.1 M
community-mysql-server x86_64 8.0.16-1.fc30 updates 21 M
openssl-devel x86_64 1:1.1.1c-2.fc30 updates 2.2 M
perl-Memoize noarch 1.03-438.fc30 updates 66 k
perl-Importer noarch 0.025-4.fc30 fedora 40 k
perl-JSON noarch 4.02-1.fc30 fedora 98 k
perl-MIME-Charset noarch 1.012.2-7.fc30 fedora 49 k
perl-Term-Size-Perl x86_64 0.031-4.fc30 fedora 21 k
perl-Term-Table noarch 0.013-2.fc30 fedora 41 k
perl-Test-Simple noarch 2:1.302162-1.fc30 fedora 513 k
protobuf x86_64 3.6.1-3.fc30 fedora 907 k
protobuf-lite x86_64 3.6.1-3.fc30 fedora 149 k
sombok x86_64 2.4.0-9.fc30 fedora 45 k
Installing weak dependencies:
perl-Term-Size-Any noarch 0.002-27.fc30 updates 13 k
perl-Unicode-LineBreak x86_64 2019.001-2.fc30 fedora 120 k
Transaction Summary
=============================================================================
Install 20 Packages
Total download size: 129 M
Installed size: 597 M
Downloading Packages:
(1/20): community-mysql-devel-8.0.16-1.fc30. 96 kB/s | 89 kB 00:00
(2/20): community-mysql-common-8.0.16-1.fc30 90 kB/s | 86 kB 00:00
(3/20): community-mysql-errmsg-8.0.16-1.fc30 391 kB/s | 487 kB 00:01
(4/20): community-mysql-8.0.16-1.fc30.x86_64 4.0 MB/s | 10 MB 00:02
(5/20): community-mysql-libs-8.0.16-1.fc30.x 397 kB/s | 1.1 MB 00:02
(6/20): community-mysql-server-8.0.16-1.fc30 7.1 MB/s | 21 MB 00:02
(7/20): openssl-devel-1.1.1c-2.fc30.x86_64.r 1.6 MB/s | 2.2 MB 00:01
(8/20): perl-Memoize-1.03-438.fc30.noarch.rp 109 kB/s | 66 kB 00:00
(9/20): perl-Term-Size-Any-0.002-27.fc30.noa 34 kB/s | 13 kB 00:00
(10/20): perl-Importer-0.025-4.fc30.noarch.r 75 kB/s | 40 kB 00:00
(11/20): perl-MIME-Charset-1.012.2-7.fc30.no 170 kB/s | 49 kB 00:00
(12/20): perl-JSON-4.02-1.fc30.noarch.rpm 120 kB/s | 98 kB 00:00
(13/20): perl-Term-Size-Perl-0.031-4.fc30.x8 128 kB/s | 21 kB 00:00
(14/20): perl-Term-Table-0.013-2.fc30.noarch 223 kB/s | 41 kB 00:00
(15/20): perl-Unicode-LineBreak-2019.001-2.f 303 kB/s | 120 kB 00:00
(16/20): perl-Test-Simple-1.302162-1.fc30.no 583 kB/s | 513 kB 00:00
(17/20): protobuf-lite-3.6.1-3.fc30.x86_64.r 795 kB/s | 149 kB 00:00
(18/20): sombok-2.4.0-9.fc30.x86_64.rpm 172 kB/s | 45 kB 00:00
(19/20): protobuf-3.6.1-3.fc30.x86_64.rpm 837 kB/s | 907 kB 00:01
(20/20): community-mysql-test-8.0.16-1.fc30. 7.4 MB/s | 92 MB 00:12
-----------------------------------------------------------------------------
Total 8.0 MB/s | 129 MB 00:16
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : community-mysql-common-8.0.16-1.fc30.x86_64 1/20
Installing : community-mysql-8.0.16-1.fc30.x86_64 2/20
Installing : community-mysql-errmsg-8.0.16-1.fc30.x86_64 3/20
Installing : community-mysql-libs-8.0.16-1.fc30.x86_64 4/20
Installing : sombok-2.4.0-9.fc30.x86_64 5/20
Installing : protobuf-lite-3.6.1-3.fc30.x86_64 6/20
Running scriptlet: community-mysql-server-8.0.16-1.fc30.x86_64 7/20
Installing : community-mysql-server-8.0.16-1.fc30.x86_64 7/20
Running scriptlet: community-mysql-server-8.0.16-1.fc30.x86_64 7/20
Installing : protobuf-3.6.1-3.fc30.x86_64 8/20
Installing : perl-Term-Size-Perl-0.031-4.fc30.x86_64 9/20
Installing : perl-Term-Size-Any-0.002-27.fc30.noarch 10/20
Installing : perl-MIME-Charset-1.012.2-7.fc30.noarch 11/20
Installing : perl-Unicode-LineBreak-2019.001-2.fc30.x86_64 12/20
Installing : perl-JSON-4.02-1.fc30.noarch 13/20
Installing : perl-Importer-0.025-4.fc30.noarch 14/20
Installing : perl-Term-Table-0.013-2.fc30.noarch 15/20
Installing : perl-Test-Simple-2:1.302162-1.fc30.noarch 16/20
Installing : perl-Memoize-1.03-438.fc30.noarch 17/20
Installing : openssl-devel-1:1.1.1c-2.fc30.x86_64 18/20
Installing : community-mysql-devel-8.0.16-1.fc30.x86_64 19/20
Installing : community-mysql-test-8.0.16-1.fc30.x86_64 20/20
Running scriptlet: community-mysql-test-8.0.16-1.fc30.x86_64 20/20
Verifying : community-mysql-8.0.16-1.fc30.x86_64 1/20
Verifying : community-mysql-common-8.0.16-1.fc30.x86_64 2/20
Verifying : community-mysql-devel-8.0.16-1.fc30.x86_64 3/20
Verifying : community-mysql-errmsg-8.0.16-1.fc30.x86_64 4/20
Verifying : community-mysql-libs-8.0.16-1.fc30.x86_64 5/20
Verifying : community-mysql-server-8.0.16-1.fc30.x86_64 6/20
Verifying : community-mysql-test-8.0.16-1.fc30.x86_64 7/20
Verifying : openssl-devel-1:1.1.1c-2.fc30.x86_64 8/20
Verifying : perl-Memoize-1.03-438.fc30.noarch 9/20
Verifying : perl-Term-Size-Any-0.002-27.fc30.noarch 10/20
Verifying : perl-Importer-0.025-4.fc30.noarch 11/20
Verifying : perl-JSON-4.02-1.fc30.noarch 12/20
Verifying : perl-MIME-Charset-1.012.2-7.fc30.noarch 13/20
Verifying : perl-Term-Size-Perl-0.031-4.fc30.x86_64 14/20
Verifying : perl-Term-Table-0.013-2.fc30.noarch 15/20
Verifying : perl-Test-Simple-2:1.302162-1.fc30.noarch 16/20
Verifying : perl-Unicode-LineBreak-2019.001-2.fc30.x86_64 17/20
Verifying : protobuf-3.6.1-3.fc30.x86_64 18/20
Verifying : protobuf-lite-3.6.1-3.fc30.x86_64 19/20
Verifying : sombok-2.4.0-9.fc30.x86_64 20/20
Installed:
community-mysql-8.0.16-1.fc30.x86_64
community-mysql-devel-8.0.16-1.fc30.x86_64
community-mysql-errmsg-8.0.16-1.fc30.x86_64
community-mysql-test-8.0.16-1.fc30.x86_64
perl-Term-Size-Any-0.002-27.fc30.noarch
perl-Unicode-LineBreak-2019.001-2.fc30.x86_64
community-mysql-common-8.0.16-1.fc30.x86_64
community-mysql-libs-8.0.16-1.fc30.x86_64
community-mysql-server-8.0.16-1.fc30.x86_64
openssl-devel-1:1.1.1c-2.fc30.x86_64
perl-Memoize-1.03-438.fc30.noarch
perl-Importer-0.025-4.fc30.noarch
perl-JSON-4.02-1.fc30.noarch
perl-MIME-Charset-1.012.2-7.fc30.noarch
perl-Term-Size-Perl-0.031-4.fc30.x86_64
perl-Term-Table-0.013-2.fc30.noarch
perl-Test-Simple-2:1.302162-1.fc30.noarch
protobuf-3.6.1-3.fc30.x86_64
protobuf-lite-3.6.1-3.fc30.x86_64
sombok-2.4.0-9.fc30.x86_64
Complete!
Having installed MySQL Community Edition, I wanted to start the mysql
service
with this command:
sudo service mysqld start |
sudo service mysqld start
Unfortunately, the service
utility wasn’t installed. That surprised me. While I could have run this command:
systemctl start mysqld.service |
systemctl start mysqld.service
A better solution was to install any missing code components. I determined that the service
utility is part of the initscripts
package; and I installed it with the following command:
sudo yum install -y initscripts |
sudo yum install -y initscripts
Display detailed console log →
Fedora Modular 30 - x86_64 30 kB/s | 18 kB 00:00
Fedora Modular 30 - x86_64 - Updates 40 kB/s | 17 kB 00:00
Fedora 30 - x86_64 - Updates 43 kB/s | 17 kB 00:00
Fedora 30 - x86_64 58 kB/s | 19 kB 00:00
google-chrome-unstable 12 kB/s | 1.3 kB 00:00
google-chrome 16 kB/s | 1.3 kB 00:00
Dependencies resolved.
=============================================================================
Package Architecture Version Repository Size
=============================================================================
Installing:
initscripts x86_64 10.02-1.fc30 updates 202 k
Transaction Summary
=============================================================================
Install 1 Package
Total download size: 202 k
Installed size: 1.1 M
Downloading Packages:
initscripts-10.02-1.fc30.x86_64.rpm 296 kB/s | 202 kB 00:00
-----------------------------------------------------------------------------
Total 162 kB/s | 202 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : initscripts-10.02-1.fc30.x86_64 1/1
Running scriptlet: initscripts-10.02-1.fc30.x86_64 1/1
Verifying : initscripts-10.02-1.fc30.x86_64 1/1
Installed:
initscripts-10.02-1.fc30.x86_64
Complete! |
Fedora Modular 30 - x86_64 30 kB/s | 18 kB 00:00
Fedora Modular 30 - x86_64 - Updates 40 kB/s | 17 kB 00:00
Fedora 30 - x86_64 - Updates 43 kB/s | 17 kB 00:00
Fedora 30 - x86_64 58 kB/s | 19 kB 00:00
google-chrome-unstable 12 kB/s | 1.3 kB 00:00
google-chrome 16 kB/s | 1.3 kB 00:00
Dependencies resolved.
=============================================================================
Package Architecture Version Repository Size
=============================================================================
Installing:
initscripts x86_64 10.02-1.fc30 updates 202 k
Transaction Summary
=============================================================================
Install 1 Package
Total download size: 202 k
Installed size: 1.1 M
Downloading Packages:
initscripts-10.02-1.fc30.x86_64.rpm 296 kB/s | 202 kB 00:00
-----------------------------------------------------------------------------
Total 162 kB/s | 202 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : initscripts-10.02-1.fc30.x86_64 1/1
Running scriptlet: initscripts-10.02-1.fc30.x86_64 1/1
Verifying : initscripts-10.02-1.fc30.x86_64 1/1
Installed:
initscripts-10.02-1.fc30.x86_64
Complete!
Then, I ran the mysql_secure_installation script to secure the installation:
mysql_secure_installation |
mysql_secure_installation
The script set the root
user’s password, remove the anonymous user, disallow remote root
login, and remove the test databases. Then, I verified connecting to the MySQL database with the following syntax:
I enabled the MySQL Service to start with each reboot of the Fedora instance. I used the following command:
systemctl enable mysqld.service |
systemctl enable mysqld.service
It creates the following link:
ln -s '/etc/systemd/system/multi-user.target.wants/mysqld.service' '/usr/lib/systemd/system/mysqld.service' |
ln -s '/etc/systemd/system/multi-user.target.wants/mysqld.service' '/usr/lib/systemd/system/mysqld.service'
The next step requires setting up a sample studentdb
database. The syntax has changed from prior releases. Here are the three steps:
- Create the
studentdb
database with the following command as the MySQL root
user:
mysql> CREATE DATABASE studentdb; |
mysql> CREATE DATABASE studentdb;
- Grant the
root
user the privilege to grant to others, which root does not have by default. You use the following syntax as the MySQL root
user:
mysql> GRANT ALL ON *.* TO 'root'@'localhost'; |
mysql> GRANT ALL ON *.* TO 'root'@'localhost';
- Create the user with a clear English password and grant the user
student
full privileges on the studentdb
database:
mysql> CREATE USER 'student'@'localhost' IDENTIFIED WITH mysql_native_password BY 'student';
mysql> GRANT ALL ON studentdb.* TO 'student'@'localhost'; |
mysql> CREATE USER 'student'@'localhost' IDENTIFIED WITH mysql_native_password BY 'student';
mysql> GRANT ALL ON studentdb.* TO 'student'@'localhost';
If you fail to specify mysql_native_password
when creating the user and use the older syntax like the following example:
mysql> CREATE USER 'student'@'localhost' IDENTIFIED BY 'student';
mysql> GRANT ALL ON studentdb.* TO 'student'@'localhost'; |
mysql> CREATE USER 'student'@'localhost' IDENTIFIED BY 'student';
mysql> GRANT ALL ON studentdb.* TO 'student'@'localhost';
The GRANT
command will raise the following error:
ERROR 1410 (42000): You are not allowed to create a user with GRANT |
ERROR 1410 (42000): You are not allowed to create a user with GRANT
My students always struggle initially with basic Linux skills. I wrote little function for their .bashrc
file to help them avoid the frustration. It finds and displays all errors by file name, line number and error message for a collection of log files in a single directory (or folder).
errors()
{
# Determine if any log files exist and check for errors.
label="File Name:Line Number:Error Code"
list=`ls ./*.$1 | wc -l`
if [[ $list} -eq 1 ]]; then
echo ${label}
echo "--------------------------------------------------"
filename=`ls *.txt`
echo ${filename}:`find . -type f | grep -in *.txt -e ora\- -e pls\- -e sp2\-`
elif [[ ${list} -gt 1 ]]; then
echo ${label}
echo "--------------------------------------------------"
find . -type f | grep -in *.txt -e ora\- -e pls\- -e sp2\-
fi
} |
errors()
{
# Determine if any log files exist and check for errors.
label="File Name:Line Number:Error Code"
list=`ls ./*.$1 | wc -l`
if [[ $list} -eq 1 ]]; then
echo ${label}
echo "--------------------------------------------------"
filename=`ls *.txt`
echo ${filename}:`find . -type f | grep -in *.txt -e ora\- -e pls\- -e sp2\-`
elif [[ ${list} -gt 1 ]]; then
echo ${label}
echo "--------------------------------------------------"
find . -type f | grep -in *.txt -e ora\- -e pls\- -e sp2\-
fi
}
Let’s say you name your log files with a file extension of .txt, then you would call the function like this:
It would return output like the following:
common_lookup_lab.txt:229:ORA-02275: such a referential constraint already exists in the table
common_lookup_lab.txt:239:ORA-02275: such a referential constraint already exists in the table |
common_lookup_lab.txt:229:ORA-02275: such a referential constraint already exists in the table
common_lookup_lab.txt:239:ORA-02275: such a referential constraint already exists in the table
As always, I hope this helps those looking for a solution.
After you create and provision the Oracle Database 11g XE, you create an instance with the following two step process.
- Create a
student
Oracle user account with the following command:
CREATE USER student IDENTIFIED BY student
DEFAULT TABLESPACE users QUOTA 200M ON users
TEMPORARY TABLESPACE temp; |
CREATE USER student IDENTIFIED BY student
DEFAULT TABLESPACE users QUOTA 200M ON users
TEMPORARY TABLESPACE temp;
- Grant necessary privileges to the newly created
student
user:
GRANT CREATE CLUSTER, CREATE INDEXTYPE, CREATE OPERATOR
, CREATE PROCEDURE, CREATE SEQUENCE, CREATE SESSION
, CREATE TABLE, CREATE TRIGGER, CREATE TYPE
, CREATE VIEW TO student; |
GRANT CREATE cluster, CREATE indextype, CREATE operator
, CREATE PROCEDURE, CREATE SEQUENCE, CREATE SESSION
, CREATE TABLE, CREATE TRIGGER, CREATE TYPE
, CREATE VIEW TO student;
As always, I hope this helps those looking for how to do something that’s less than clear because everybody uses tools.