No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Hand on heart – I use SQLServer most of the time. | Hand on heart – I use SQLServer most of the time. When I am asked questions about MySQL, I always need to step out of my comfort zone. | ||
This article can hopefully help me in my efforts with this and | This article can hopefully help me in my efforts with this and be useful to you as well. | ||
# Make | # Make sure you have MySql installed – the server and not only the connectors – you need both for local work. | ||
# Start a cmd window as admin and cd to c:\program files\MySql\MySql server <version>\bin | # Start a cmd window as admin and cd to c:\program files\MySql\MySql server <version>\bin | ||
# Start mysql.exe – if asked for a password it is probably “root” | # Start mysql.exe – if asked for a password, it is probably “root”. | ||
# | # You should now have an mysql> prompt | ||
# Create a database called my1 : CREATE DATABASE my1; | # Create a database called my1 : CREATE DATABASE my1; | ||
# Use a database called my1: USE my1 | # Use a database called my1: USE my1 | ||
Ok – now we have the database – switch back to MDriven: | Ok – now, we have the database – switch back to MDriven: | ||
We want to use the my1 db: | We want to use the my1 db: | ||
Line 14: | Line 14: | ||
[[File:Mysql_-_1.png|frameless|411x411px]] | [[File:Mysql_-_1.png|frameless|411x411px]] | ||
Change to PersistenceMapperMySql, make sure it is used in EcoProject1.PersistenceMapper= PersistenceMapperMySql1, set its connection string to “server=localhost;database=my1;User Id=root;password=root; Charset=utf8” | Change to PersistenceMapperMySql, and make sure it is used in EcoProject1.PersistenceMapper= PersistenceMapperMySql1, set its connection string to “server=localhost;database=my1;User Id=root;password=root; Charset=utf8” | ||
* Generate code if you have not already | * Generate code, if you have not already | ||
* Compile if you have not already | * Compile, if you have not already | ||
* Then | * Then, generate database. | ||
If you get this error: | If you get this error: | ||
Line 39: | Line 39: | ||
[[File:Mysql - 4.png|none|frame|248x248px]] | [[File:Mysql - 4.png|none|frame|248x248px]] | ||
From today these settings are automatically applied when | From today onward, these settings are automatically applied when you press the MySql 5.0 Setup option found here: | ||
[[File:Mysql_-_5.png|border|frameless|251x251px]] | [[File:Mysql_-_5.png|border|frameless|251x251px]] | ||
[[Category:SQL]] | [[Category:SQL]] |
Revision as of 07:32, 20 March 2023
Hand on heart – I use SQLServer most of the time. When I am asked questions about MySQL, I always need to step out of my comfort zone.
This article can hopefully help me in my efforts with this and be useful to you as well.
- Make sure you have MySql installed – the server and not only the connectors – you need both for local work.
- Start a cmd window as admin and cd to c:\program files\MySql\MySql server <version>\bin
- Start mysql.exe – if asked for a password, it is probably “root”.
- You should now have an mysql> prompt
- Create a database called my1 : CREATE DATABASE my1;
- Use a database called my1: USE my1
Ok – now, we have the database – switch back to MDriven:
We want to use the my1 db:
Change to PersistenceMapperMySql, and make sure it is used in EcoProject1.PersistenceMapper= PersistenceMapperMySql1, set its connection string to “server=localhost;database=my1;User Id=root;password=root; Charset=utf8”
- Generate code, if you have not already
- Compile, if you have not already
- Then, generate database.
If you get this error:
… it is due to the SupportsFilteredIndex setting :
Change it to false.
Another thing that differs from SqlServer is the Top keyword as in “select top 15 * from stuff” is written as “select * from stuff limit 15” in MySQL
This is fixed by changing these properties of the persistenceMapperMySQL.SqlDatabaseConfig:
SqlTopKeyword – set this to empty string
SqlTopQuerySuffix – set this to limit {0}
like this:
From today onward, these settings are automatically applied when you press the MySql 5.0 Setup option found here: